承接 qruto/laravel-flora 相关项目开发

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

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

qruto/laravel-flora

Composer 安装命令:

composer require qruto/laravel-flora

包简介

Install and update Laravel application with single command

README 文档

README

Laravel Flora Logo

A convenient way to automate setup of your application.

Laravel Flora Code Example

Build Status Styles check Types check Refactor code Total Downloads Latest Stable Version

Laravel Flora Demo

Goal

The main goal of Flora is define and automate the setup process of Laravel application. All necessary actions to make the application ready to work in one place.

Packages discovering, assets building and publishing, running database migrations, caching etc...

🧠🚀 Put the knowledge of setup instructions at the application level.

Introduction

Revival of Laravel Initializer. Rethinked, improved, prettified, renamed.

Flora allows you to bring Laravel application to live by one command. Use default or define custom chain of actions required to install or update an application.

Run install when you fetch a fresh application to prepare it to launch on new environment.

  • after git clone

Run update on every dependency or source code change.

  • after composer install|update
  • after git pull|checkout|megre|...
  • in deploy script
  • in CI/CD pipeline

it will take care of the rest of the work.

Support

Since of February 24, unfortunately I haven't any commercial work, permanent living place or the ability to plan anything for the long term. However, I have a greater desire to continue creating useful solutions for people around the world. It makes me feel better these days.

support me

GitHub Sponsorships profile is ready! There you can find current work, future plans, goals and dreams... Your stars make me happier each day ❤️ ⭐ Sponsorship will enable us to live more peacefully and continue to work on useful solutions for you.

I would be very grateful for mentions or just a sincere "thank you".

💳 Sponsoring directly to savings jar with card or Apple Pay/Google Pay.

Installation

Via Composer:

composer require qruto/laravel-flora

Usage

Replace installation section in readme file with:

php artisan install

Refresh application state by:

php artisan update

ℹ️ Instruction depends on current environment. Package has predefined actions suitable for most cases.

See detailed output in verbosity mode:

php artisan app:update -v

You can automate the update process by adding @php artisan update command to your application composer.json script post-autoload-dump section and remove default vendor:publish command from post-update-cmd section. update command will take care of assets publishing for you.

Setup it with:

php artisan flora:setup --script

composer.json changes:

"post-autoload-dump": [
    "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 
-     "@php artisan package:discover --ansi"
+     "@php artisan update"
],
- "post-update-cmd": [
-     "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
- ],

Register Task Scheduler

Conditions:

  • any scheduler task registered
  • installation process performed
  • application in production environment

then you will be prompted for the addition of a cron entry to run the task scheduler every minute.

Task Scheduler

Configuration

To customize instructions for each environment, you need to publish setup files.

php artisan flora:setup

This command will create routes/setup.php file with predefined instructions for local and production environments.

use Qruto\Flora\Run;

App::install('local', fn (Run $run) => $run
    ->command('key:generate')
    ->command('migrate')
    ->command('storage:link')
    ->script('build')
);

App::install('production', fn (Run $run) => $run
    ->command('key:generate', ['--force' => true])
    ->command('migrate', ['--force' => true])
    ->command('storage:link')
    ->script('cache')
    ->script('build')
);

App::update('local', fn (Run $run) => $run
    ->command('migrate')
    ->command('cache:clear')
    ->script('build')
);

App::update('production', fn (Run $run) => $run
    ->script('cache')
    ->command('migrate', ['--force' => true])
    ->command('cache:clear')
    ->command('queue:restart')
    ->script('build')
);

Feel free to change it any way you need or add specific environment like staging.

`build` and `cache` script details

build script contains assets building commands:

npm install
npm run build

cache script provides general application caching:

php artisan route:cache
php artisan config:cache
php artisan event:cache

In addition, it will create config/flora.php for configuration assets publishing.

return [
    /*
    |--------------------------------------------------------------------------
    | Force Assets Publish
    |--------------------------------------------------------------------------
    |
    | Force publish assets on every installation or update. By default, assets
    | will always be force published, which would completely automate the
    | setup. Switch it to false if you want to manually publish assets.
    | For example if you prefer to commit them.
    */
    'force_publish' => true,

    /*
    |--------------------------------------------------------------------------
    | Publishable Assets
    |--------------------------------------------------------------------------
    |
    | List of assets that will be published during installation or update.
    | Most of required assets detects on the way. If you need specific
    | tag or provider, feel free to add it to the array.
    */
    'assets' => [
        'laravel-assets',
    ],
];

If you need to customize just assets publishing, you can publish only configuration file:

php artisan vendor:publish --tag=flora-config

Side Packages Support

Flora automatically detects several packages for performing necessary actions on install or update. For example: publish Vapor UI assets, generate IDE helper files, terminate Horizon workers etc.

Supported:

Soon:

Custom Scripts

Override or define custom script in service provider's boot method:

Run::newScript('cache', fn (Run $run) => $run
    ->command('route:cache')
    ->command('config:cache')
    ->command('event:cache')
    ->command('view:cache')
);

Available Actions

$run
    ->command('command') // Run artisan command
    ->script('build') // Perform custom script
    ->exec('process') // Execute external process
    ->job(new JobClass) // Dispatch job
    ->call(fn () => makeSomething()) // Call callable function 
    ->notify('Done!') // Send notification

Upgrading

Please see UPGRADING for details.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email bro@qruto.to instead of using the issue tracker.

Credits

Thanks Nuno Maduro for laravel-desktop-notifier package which brings desktop notifications to Laravel.

License

The MIT License (MIT). Please see License File for more information.

qruto/laravel-flora 适用场景与选型建议

qruto/laravel-flora 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 98.19k 次下载、GitHub Stars 达 131, 最近一次更新时间为 2023 年 03 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「process」 「deploy」 「command」 「install」 「Tasks」 「update」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 qruto/laravel-flora 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 qruto/laravel-flora 我们能提供哪些服务?
定制开发 / 二次开发

基于 qruto/laravel-flora 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 98.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 131
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 131
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-07