hnher/laravel

Laravel 的手脚架项目

Maintainers

Details

github.com/hnher/laravel

Source

Issues

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

v1.5.2 2020-12-21 06:49 UTC

This package is auto-updated.

Last update: 2024-04-21 13:46:19 UTC


README

68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6474666276766b79702f696d6167652f75706c6f61642f76313536363333313337372f6c61726176656c2d6c6f676f6c6f636b75702d636d796b2d7265642e737667

Build Status Total Downloads Latest Stable Version License

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

框架的手脚架

简化基于 Laravel 新项目初始化的时间。

已完成功能

  1. 日志 JSON 化
  2. 缓存基类设置
  3. 允许跨域请求
  4. 统一格式化返回
  5. Makefile 自动脚本
  6. 基于 RocketMQ 的秒级任务调度

使用

composer create-project hnher/laravel LaravelApp

延时任务

延时任务基于阿里云 RocketMQ 和 pm2 搭建。RocketMQ 作为消息传递、pm2 作为进程守护

服务器需求

  1. 阿里云 RocketMQ
  2. pm2

编写任务消息实例

namespace App\Modules\Scheduler\Messages;


class TestMessage extends Message
{
    public function __construct(string $cmd = 'Scheduler:Test', array $params = [], string $key = '', int $delay = 10)
    {
        parent::__construct($cmd, $params, $key, $delay);
    }
}

发送延时任务消息

可以在代码任何地方使用 Scheduler 门面的 sendMessage 方法发送消息实例

namespace App\Console\Commands;

use App\Facades\Scheduler\Scheduler;
use App\Modules\Scheduler\Messages\TestMessage;
use Illuminate\Console\Command;

class TestCommand extends Command
{
    protected $signature = 'Test:Test';

    protected $description = '测试使用脚本';

    /**
     * 业务处理
     */
    public function handle()
    {
        $res = Scheduler::sendMessage(new TestMessage());

        dd($res);
    }
}

消费任务消息

可以在 ecosystem.config.js 文件中指定运行实例和其他配置,也可以继承 ConsumerCommand 自定义消费

pm2 start ecosystem.config.js

Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.

License

The Laravel framework is open-sourced software licensed under the MIT license.