承接 00f100/fcphp-autoload 相关项目开发

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

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

00f100/fcphp-autoload

Composer 安装命令:

composer require 00f100/fcphp-autoload

包简介

Autoload providers and routes into composer vendor package

README 文档

README

Package to autoload providers and routes into another composer packages

Build Status codecov Total Downloads

How to install

Composer:

$ composer require 00f100/fcphp-autoload

or add in composer.json

{
    "require": {
        "00f100/fcphp-autoload": "*"
    }
}

How to use

Create my providers.php

<?php

return [
    \path\to\SomeClass::class,
    \path\to\package\Cool::class
];

Create my routes.php

<?php

return [
    'path/to/route' => [
        'post' => 'SiteController@method'
    ]
];

Find content in directory

<?php

use FcPhp\Autoload\Autoload;

/**
 * Method to load path and find match's
 *
 * @param string $pathExpression Directory to find file(s)
 * @param array $fileNameMatch List of filename
 * @param array $extensionMatch List of enable extensions
 * @return void
 */
$autoload = Autoload::getInstance();
$autoload->path(string $pathExpression, array $fileNameMatch, array $extensionMatch);

/*
    Example to find inside composer directory

    ============================================
    Example directory:
    ============================================

    vendor/
        00f100/
            fcphp-di/
                autoload/
                    providers.php
                    prividers.txt
            fcphp-i18n/
            fcphp-provider/
                autoload/
                    routes.php
        doctrine/
            doctrine/
            instructor/
        cake/
            bin/
            cake/
                autoload/
                    providers.php

*/
$autoload->path('vendor/*/*/autoload', ['providers', 'routes'], ['php']);
/*
    ============================================
    Below example match this files:
    ============================================

    vendor/00f100/fcphp-di/autoload/providers.php
    vendor/00f100/fcphp-provider/autoload/routes.php
    vendor/cake/cake/autoload/providers.php
*/

Get content of files

/*
    ============================================
    Get the content using 'get' method
    ============================================
    [
        'path/to/route' => [
            'post' => 'SiteController@method'
        ]
    ]
    $arrayProviders = $autoload->get('providers');

    [
        \path\to\SomeClass,
        \path\to\package\Cool
    ]
    $arrayRoutes = $autoload->get('routes');
*/
/**
 * Method to return autoloaded files
 *
 * @param string $key Filename
 * @return array
 */
$autoload->get(string $fileName);

Triggers

Before Match

This clousure run before match run

$instance->beforeMatch(function(string $pathExpression, array $fileNameMatch, array $extensionMatch) {
    // your code here
});

Before Match Again

This clousure run before match some dir again

$instance->beforeMatchAgain(function(array $paths, array $files, array $extensions, string $path, string $now) {
    // your code here
});

Before Storage

This clousure run before storage file content

$instance->beforeStorage(function(string $file, string $filePath) {
    // your code here
});

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固