Search code examples
phpsocketslaravel-4real-time

Laravel 4: Any way to run PHP Artisan command in PHP code?


I'm fairly new on Laravel's technology regarding real-time application. I'm trying to make a notification system and from what I Google, using some kind of socket server is the best way.

So I'm trying to use this: https://github.com/BrainBoxLabs/brain-socket

But I have no idea how to run it on live server later, since I don't own the server itself I can't run commands like: php artisan brainsocket:start in terminal, so I need to figure out how to run that command by using php code?

Or if my method is wrong, how to use that brain-socket in live server?


Solution

  • You can do this with

    Artisan::call('brainsocket:start', $args);
    

    where $args is an array of arguments.

    See the Laravel docs.