Artisan is a great commandline tool for Laravel Framework. It provides support for application development using powerful Symfony console component.
Just the other day i was working on a Laravel 4 package for my own practice and i found the need to run migrations for my database and Artisan came in handy doing that but i had to automate the whole process so that the migrations would run on package initiation. Now, thinking about commandline and PHP one though comes to mind : exec. But fortunately, Laravel provides an equally powerful API for running Artisan commands from inside the Laravel project.
Now, that is what you call a utility!
All i had to do was run following construct:
Artisan::call('migrate', array('option' => '--bench', 'argument' => 'vendor/package'));
But it did not work, evidently because of ever evolving nature of Laravel documentation which failed to mention the correct syntax. But the following worked for me 🙂
Latest posts by alexey (see all)
- Zend Soap NULL Reponse - August 29, 2018
- Quick Facts About WooCommerce - April 25, 2018
- WordPress stuck on a “Too many redirects” error loop when using SSL - January 17, 2018