davek1312/app

davek1312包的管理包

v0.2.11 2017-04-30 23:08 UTC

README

为davek1312包提供管理包。

安装

该包可在Packagist上获取,您可以使用Composer进行安装。

composer require davek1312/app

注册组件

您可以注册以下组件: 数据库迁移控制台命令配置文件

创建您的注册类

<?php

namespace YourNamespace;

use Davek1312\App\Registry;

class YourRegistry extends Registry {
    
    protected function register() {
        // Register the directory of your configuration files
        $this->registerConfig(__DIR__.'/path/to/config');
        
        // Register the directory of your database migration files
        $this->registerMigrations(__DIR__.'/path/to/migrations');
        
        // Register the class names of your console commands
        $this->registerCommands('YourNamespace\Console\Commands\YourCommand');
        
        // Register the package language files
        $this->registerLang('package-name', __DIR__.'path/to/lang');
        
        // Register custom validation rule using a closure
        $this->registerValidationRules('foo', function ($attribute, $value, $parameters, $validator) {
            return $value == 'foo';
        });
        
        // Register custom validation rule using a method
        $this->registerValidationRules('foo', 'FooValidator@validate');
        
        // Register an implicit custom validation rule
        $this->registerImplicitValidationRules('foo', 'FooValidator@validateImplicit');
        
        // Register a custom validation rule replacer. This is used to replace custom place holders.
        $this->registerValidationReplacers('foo', function($message, $attribute, $rule, $parameters) {
            return str_replace('replace', 'with', $message);
        });
        
        // Register the package routes files
        $this->registerRoutes(__DIR__.'path/to/routes');
    }
}

注册您的注册类

将管理文件夹(即vendor/davek1312/app/davek1312)复制到您的应用根目录,并将YourNamespace\YourRegistry添加到app.php

<?php

return [
    
     'root_package_dir' => __DIR__.'/../',
    
        'registry' => [
    
            'YourNamespace\YourRegistry',
    
        ],

];