dflydev/psr0-resource-locator-composer-service-provider

Composer PSR-0 资源定位服务提供者

dev-master / 1.0.x-dev 2014-07-16 21:19 UTC

This package is auto-updated.

Last update: 2024-08-29 03:29:11 UTC


README

为Silex应用程序提供Composer PRS-0 资源定位服务。

要求

  • PHP 5.3+
  • PSR-0 资源定位实现 Silex 提供者

安装

通过Composer

使用

<?php

use Dflydev\Silex\Provider\Psr0ResourceLocator\Psr0ResourceLocatorServiceProvider;
use Dflydev\Silex\Provider\Psr0ResourceLocator\Composer\ComposerResourceLocatorServiceProvider;
use Silex\Application;

$app = new Application;

$app->register(new Psr0ResourceLocatorServiceProvider);
$app->register(new ComposerResourceLocatorServiceProvider);

// Search all PSR-0 namespaces registered by Composer
// to find the first directory found looking like:
// "/Vendor/Project/Resources/mappings"
$mappingDirectory = $app['psr0_resource_locator']->findFirstDirectory(
    'Vendor\Project\Resources\mappings'
);

// Search all PSR-0 namespaces registered by Composer
// to find all templates directories looking like:
// "/Vendor/Project/Resources/templates"
$templateDirs = $app['psr0_resource_locator']->findDirectories(
    'Vendor\Project\Resources\templates',
);

配置

服务

  • psr0_resource_locator_composer: Composer PSR-0 资源定位,实例 Dflydev\Psr0ResourceLocator\Composer\ComposerResourceLocator.
  • psr0_resource_locator_composer.class_loader_locator: Composer 类加载器定位器,实例 Dflydev\Composer\Autoload\ClassLoaderLocator.

许可协议

MIT,请参阅LICENSE。

社区

如果您有任何问题或想提供帮助,请加入irc.freenode.net上的#dflydev或#silex-php频道。