Created
July 15, 2016 10:15
-
-
Save dgoguerra/5857b9312413474b8117c7031e4c8bc7 to your computer and use it in GitHub Desktop.
Minimal code to load a Laravel application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__.'/vendor/autoload.php'; | |
function bootstrapApplication() | |
{ | |
$app = require __DIR__.'/vendor/laravel/laravel/bootstrap/app.php'; | |
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); | |
$app['config']['database.default'] = 'mysql'; | |
$app['config']['database.connections.mysql.database'] = 'test_db'; | |
$app['config']['database.connections.mysql.username'] = 'test_app'; | |
$app['config']['database.connections.mysql.password'] = 'secret'; | |
return $app; | |
} | |
$app = bootstrapApplication(); | |
// load service providers | |
$app->register('App\Providers\CustomServiceProvider'); | |
// edit the app's settings | |
$app['config']['app.debug'] = true; | |
// obtain a class from the Service Container | |
$service = $app['App\Services\CustomService']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment