Skip to content

Instantly share code, notes, and snippets.

@tiagofrancafernandes
Last active June 1, 2022 15:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiagofrancafernandes/8c3cdbbd7b391ef6cefa9a0d8d1af80d to your computer and use it in GitHub Desktop.
Save tiagofrancafernandes/8c3cdbbd7b391ef6cefa9a0d8d1af80d to your computer and use it in GitHub Desktop.
Extract Laravel core for use outside the framework
<?php
// https://gist.github.com/tiagofrancafernandes/8c3cdbbd7b391ef6cefa9a0d8d1af80d
/*-------- START LARAVEL OUTSIDE ---------*/
/*
To use Laravel core without then
If you whant to use core by CLI without artisan
*/
require_once __DIR__.'/../../vendor/autoload.php';//Full path to file maybe need to change
$app = require_once __DIR__.'/../../bootstrap/app.php';//Full path to file maybe need to change
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
<?php
/*
Using core.php
*/
require_once __DIR__ . '/core.php';
//dd(config('app.name'))
//dd(config('app.env'))
dump(\Illuminate\Foundation\Inspiring::quote());
dump(\App\Models\User::count());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment