You will have to boot your a Laravel application by doing:
<?php
require 'vendor/autoload.php';
require 'bootstrap/start.php';
Then you will have access to the $app
global variable, which holds the whole Laravel application, including Artisan, so you'll be able to:
Artisan::call('migrate');
and
$app['artisan']->call('migrate');
If you have an external namespaced class, like this one:
<?php namespace App\Example;
require 'vendor/autoload.php';
require 'bootstrap/start.php';
use Form;
use Artisan;
class Example {
public function make() {
Artisan::call('migrate');
} `enter code here`
}
You can call it using:
<?php
require 'Example.php';
use App\Example\Example;
$s = new Example;
dd($s->make());
This is not advisable, but as a last resort, you can use:
return $GLOBALS['app']['artisan']->call('migrate');