假如你的项目要分离模块,比如说admin、shop、blog等等,你可能需要这个插件
详细文档:
https://nwidart.com/laravel-modules/.
https://packagist.org/packages/nwidart/laravel-modules

Laravel laravel-modules
5.4 ^1.0
5.5 ^2.0
5.6 ^3.0
5.7 ^4.0
5.8 ^5.0

安装

# install
$ composer require nwidart/laravel-modules
$ php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider"
#在composer添加"Modules\\": "Modules/"
{
  "autoload": {
    "psr-4": {
      "App\\": "app/",
      "Modules\\": "Modules/"
    }
  }
}
#运行
$ composer dump-autoload

注意事项

#lang
Lang::get('blog::group.name');
@trans('blog::group.name');
#view
view('blog::index')
view('blog::partials.sidebar')
#config
Config::get('blog.name')

命令

#创建模块
$ php artisan module:make Blog

目录结构

app/
bootstrap/
vendor/
Modules/
  ├── Blog/
      ├── Assets/
      ├── Config/
      ├── Console/
      ├── Database/
          ├── Migrations/
          ├── Seeders/
      ├── Entities/
      ├── Http/
          ├── Controllers/
          ├── Middleware/
          ├── Requests/
      ├── Providers/
          ├── BlogServiceProvider.php
          ├── RouteServiceProvider.php
      ├── Resources/
          ├── assets/
              ├── js/
                ├── app.js
              ├── sass/
                ├── app.scss
          ├── lang/
          ├── views/
      ├── Routes/
          ├── api.php
          ├── web.php
      ├── Repositories/
      ├── Tests/
      ├── composer.json
      ├── module.json
      ├── package.json
      ├── webpack.mix.js

php实现redis延时队列

写了一个简单的类实现 使用方法 $class = new RedisDelayQueue(); $class->execute(); <?php namespace app\common\service; class RedisDelay { ...

阅读全文

php获取包含10w个手机号的txt文件(逗号隔开)

txt文件格式如下 13000000000,13000000005,13000000403,13001010129,13001010688,13001010838,13001016389,13001019538,13001030005,13001042700,13001047495...

阅读全文

php使用Carbon获取2个日期之间的日期

<?php use Carbon\CarbonPeriod; $period = CarbonPeriod::create('2018-06-14', '2018-06-20'); // Iterate over the period fore...

阅读全文

欢迎留言