照亮laravel外的包裹
我对Laravel是新手,我几乎使用Laravel以外的所有L5软件包。但我有一些问题,使这些工作 这是我的composer.json文件:照亮laravel外的包裹,laravel,laravel-5,illuminate-container,Laravel,Laravel 5,Illuminate Container,我对Laravel是新手,我几乎使用Laravel以外的所有L5软件包。但我有一些问题,使这些工作 这是我的composer.json文件: { "require": { "slim/slim": "2.*", "zeuxisoo/slim-whoops": "0.2.0", "filp/whoops": "1.1.2", "illuminate/database": "5.1.*", "il
{
"require": {
"slim/slim": "2.*",
"zeuxisoo/slim-whoops": "0.2.0",
"filp/whoops": "1.1.2",
"illuminate/database": "5.1.*",
"illuminate/support": "5.1.*",
"illuminate/session": "5.1.*",
"illuminate/filesystem": "5.1.*",
"illuminate/config": "5.1.*",
"illuminate/session": "5.1.*",
"illuminate/routing": "^5.1",
"illuminate/events": "5.1.*",
"illuminate/translation": "5.1.*",
"illuminate/encryption": "5.1.*",
"illuminate/queue": "5.1.*",
"illuminate/mail": "5.1.*",
"illuminate/view": "5.1.*",
"laravelcollective/html": "5.1.*",
"iron-io/iron_mq": "~2.0",
"Mockery/Mockery": "~0.9.1",
"pimple/pimple": "3.0",
"philo/laravel-blade": "3.*",
"jenssegers/mongodb": "^2.1",
"illuminate/auth": "5.1.*",
"illuminate/bus": "5.1.*",
"illuminate/broadcasting": "5.1.*",
"illuminate/cache": "5.1.*",
"illuminate/console": "5.1.*",
"illuminate/container": "5.1.*",
"illuminate/contracts": "5.1.*",
"illuminate/cookie": "5.1.*",
"illuminate/hashing": "5.1.*",
"illuminate/http": "5.1.*",
"illuminate/log": "5.1.*",
"illuminate/pagination": "5.1.*",
"illuminate/pipeline": "5.1.*",
"illuminate/redis": "5.1.*",
"illuminate/validation": "5.1.*"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
}
}
这就是index.php:
// Import Illuminate packages
require_once '../../../vendor/autoload.php';
// set database connection and setup
require_once '../../../config/bootstrap.php';
use Illuminate\Support\Facades\Response as Response;
// Instantiate the container
$app = new Illuminate\Container\Container();
// Tell facade about the application instance
Illuminate\Support\Facades\Facade::setFacadeApplication($app);
// register application instance with container
$app['app'] = $app;
// set environment
$app['env'] = 'production';
$app->instance('request', \Illuminate\Http\Request::capture());
// Register service providers
with(new Illuminate\Events\EventServiceProvider($app))->register();
with(new Illuminate\Routing\RoutingServiceProvider($app))->register();
with(new Illuminate\Auth\AuthServiceProvider($app))->register();
with(new Illuminate\Broadcasting\BroadcastServiceProvider($app))->register();
with(new Illuminate\Bus\BusServiceProvider($app))->register();
with(new Illuminate\Cache\CacheServiceProvider($app))->register();
with(new Illuminate\Routing\ControllerServiceProvider($app))->register();
with(new Illuminate\Cookie\CookieServiceProvider($app))->register();
with(new Illuminate\Database\DatabaseServiceProvider($app))->register();
with(new Illuminate\Encryption\EncryptionServiceProvider($app))->register();
with(new Illuminate\Filesystem\FilesystemServiceProvider($app))->register();
with(new Illuminate\Hashing\HashServiceProvider($app))->register();
with(new Illuminate\Mail\MailServiceProvider($app))->register();
with(new Illuminate\Pagination\PaginationServiceProvider($app))->register();
with(new Illuminate\Pipeline\PipelineServiceProvider($app))->register();
with(new Illuminate\Queue\QueueServiceProvider($app))->register();
with(new Illuminate\Redis\RedisServiceProvider($app))->register();
with(new Illuminate\Auth\Passwords\PasswordResetServiceProvider($app))->register();
with(new Illuminate\Session\SessionServiceProvider($app))->register();
with(new Illuminate\Translation\TranslationServiceProvider($app))->register();
with(new Illuminate\Validation\ValidationServiceProvider($app))->register();
with(new Illuminate\View\ViewServiceProvider($app))->register();
with(new Collective\Html\HtmlServiceProvider($app))->register();
// Class aliases
class_alias('Collective\Html\FormFacade', 'Form');
class_alias('Collective\Html\HtmlFacade', 'Html');
// Include all the routes
$app['router']->get('/', 'TestController@index');
$app['router']->get('/view', 'TestController@show');
$app['router']->get('/{id}', 'TestController@create');
// Instantiate the request
$request = Illuminate\Http\Request::createFromGlobals();
// Dispatch the router
$response = $app['router']->dispatch($request);
// Send the response
$response->send();
和TestController类:
<?php
use Illuminate\Routing\Controller as Controller;
use Illuminate\Support\Facades\DB as DB;
use Illuminate\Support\Facades\View as View;
class TestController extends Controller {
public function show() {
return View::make('hello2');
}
}
那么您通过composer包含了laravel/framework?config类从laravel应用程序中绑定到IoC容器中,您至少需要实例化应用程序本身。也许运行createprojectlaravel/laravel
可以让您更深入地了解laravel是如何引导的。下次请添加更多信息,例如您如何使用laravel、如何集成、如何在laravel之外使用这些软件包以及如何尝试与第三方php框架集成。@Luceos我用更多信息和代码更新了我的问题。为什么不只包括laravel/framework。。它会自动加载所有依赖项。所以你通过composer包含了laravel/framework?config类从laravel应用程序中绑定到IoC容器中,您至少需要实例化应用程序本身。也许运行createprojectlaravel/laravel
可以让您更深入地了解laravel是如何引导的。下次请添加更多信息,例如您如何使用laravel、如何集成、如何在laravel之外使用这些软件包以及如何尝试与第三方php框架集成。@Luceos我用更多信息和代码更新了我的问题。为什么不只包括laravel/framework。。它将自动加载所有依赖项。