ahoulgrave/bear

v1.2.1 2017-12-11 21:11 UTC

README

PHP Bear

Bear PHP 组件项目

SensioLabsInsight Build Status Coverage Status Latest Stable Version Total Downloads

需求

  • PHP 7.1+

安装

您可以使用 composer 安装 bear

composer require ahoulgrave/bear

用法

<?php
require 'vendor/autoload.php';

use Bear\App;
use Bear\Routing\SymfonyRoutingAdapter;
use Zend\ServiceManager\ServiceManager;

$config = [
    'services' => [
        MyController::class => new MyController(),
    ],
    'factories' => [
        'routingAdapter' => function () {
            $loader = ...;
            $resource = ...;
            
            return new SymfonyRoutingAdapter($loader, $resource);
        },
    ],
];

$app = new App(new ServiceManager($config), 'routingAdapter');
$app->run();

依赖容器

作为第一个参数,您可以提供任何 PSR-11 容器。以下是一些您可以使用的容器:

路由适配器

您至少需要一个路由适配器来运行应用程序