承接 dnaber/requisite 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dnaber/requisite

最新稳定版本:1.0.0

Composer 安装命令:

composer require dnaber/requisite

包简介

A modular, extensible PHP autoloader.

README 文档

README

Inspired by Tom Buttler and Fuxia Scholz.

This library requires PHP version 5.5.0. If you're looking for older support, use the 1.0 release branch, that still supports PHP 5.3.0.

Concept

The main idea behind this autoloader is the separation of the file locating (Requisite\Rule) and file loading (Requisite\Loader) process.

One can register several rules on a main autoloader instance of Requisite\SplAutoloader. The included rule Rule\NamespaceDiretoryMapper matches namespaces to directory names (which actually implements Psr-4).

Rules

Psr4

Maps namespaces to filesystem directories relative to a base directory and base namespace as described in Psr-4.

ClassMap

Provides a static map of full qualified class names to file names.

Usage examples

/**
 * Load the Requisite library. Alternatively you can use composer's
 * autoloader via include vendor/autoload.php
 */
require_once 'src/Requisite/Requisite.php';
Requisite\Requisite::init();

$autoloader = new Requisite\SplAutoLoader;
//load the Monolog lib from the vendor/Monolog directory
$autoloader->addRule(
	new Requisite\Rule\Psr4(
		__DIR__ . '/vendor/Monolog', // base directory
		'Monolog'                    // base namespace
	)
);
// configure a ClassMap
$autoloader->addRule(
	new Requisite\Rule\ClassMap(
		[
			'Foo\Bar'  => '/vendor/package/src/Foo/Bar.php',
			'Foo\Bazz' => '/vendor/package/src/Foo/Bazz.php'
		]
	)
);

Roadmap

See issues labeled with »enhancement«

统计信息

  • 总下载量: 1.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-21