定制 usanzadunje/scaffold-laravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

usanzadunje/scaffold-laravel

Composer 安装命令:

composer require usanzadunje/scaffold-laravel

包简介

Multiple scaffolding options for Laravel application.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Multiple scaffolding options for Laravel application.

Installing Vue, adding Vue Router/Inertia as your frontend router, adding Vuex as state manager. Replacing Webpack with Vite or installing Browser Sync plugin for Webpack. Also adds scaffolding for Docker with any of these presets mentioned.

Installation

You can install the package via composer:

composer require usanzadunje/scaffold-laravel

Usage

php artisan scaffold [preset]

Available presets :

  • vue
  • vue-router (if you have vue application set up)
  • vuex (if you have vue application set up)
  • vite (replaces webpack for vite)
  • docker
  • all (installs vue, vite and docker preset all together)

Vue

Will generate following files and directories inside your resources/js directory :

  • components directory
  • composables directory
  • views directory and Example.vue inside it
  • app.js files with minimal scaffolding for Vue application
  • app.blade.php file with #app container defined
  • Change / route to return app view instead of welcome

Additionally, it will ask if you would like router or state manager installed as well.

Vue Router

Will generate following files and directories inside your resources/js directory :

  • router directory and inside it basic scaffolding for routes with one example route defined
  • Welcome.vue file inside views which will be shown for example route defined
  • ExampleApp.vue which will serve as entrypoint to router (it has defined in it)
  • It will initialize itself inside app.js file

Additionally, it will ask if you would like basic middleware scaffolding for your routes. This will then create middlewarePipeline.js file which is responsible for calling all middlewares defined on certain route. And inside router/index,js file where routes are defined it will add beforeEach navigation gourd and call this pipeline.

Routes which require middleware(s) should have meta filed with middleware property defined on them which is an array of middlewares. You can define your middlewares in middlewares directory which will be created along with example middleware.

Vuex

Will generate following files and directories inside your resources/js directory :

  • store directory and inside it basic scaffolding for vuex in module fashion
  • Module.js file inside store which is example of single module state
  • It will initialize itself inside app.js file
  • Vuex scaffolding comes along with vue-persistedstate plugin which will persist data from state in Local Storage

Vite

Will remove all packages, scripts and files associated with Webpack. Additionally, it will create vite.config.js in root of project directory and setup basic configuration.

If you have Vue installed it will add Vite plugin for Vue and optimize configuration for it as well (same goes if Vue Router or Vuex are installed)

If you installed Vue using this package it will generate app.blade.php file and Vite scaffolding will remove assets(css/js) imported using Webpack and generate @vite blade directive which will generate imports for Vite assets(css/js). If you however do not have app.blade.php file it will not try and replace these, so you will need to add @vite directive yourself to your layout file. It will also import your css/app.css file inside app.js since this is how Vite handles css.

Docker

Will generate docker-compose.yml and docker-compose.prod.yml files with container details. Also it will generate docker-compose directory which contains configuration for: nginx, php, suppervisord and initialization scripts for development and production.

It will adopt itself depending on whether you use Webpack or Vite in order to work smoothly with them and change Webpack or Vite configuration accordingly

It will change your .env file and following contents of it:

  • DB_HOST and set it to db so docker can resolve it, since database will live inside container
  • DB_USERNAME only if it is set to root and will change it to laravel
  • DB_PASSWORD only if it is set to nothing(empty) and will change it to laravel
  • DB_PORT only if it is set to something other than 3306 since this is port used by container_name

Additional information:

Database port exposed on your local machine is set to 3310 if you want to connect to it from your host machine.

Application port if using with Webpack but without Browser Sync plugin setup will be exposed to 8000(served on localhost:8000).

If you are however using Webpack with Browser Sync port exposed will be 3000 (served on localhost:3000)

When using Vite port exposed will be 3000 (served on localhost:3000)

Scripts that are responsible for applications in production / development are inside docker-compose directory, and they are init.sh / initDev.sh files respectively. Feel free to change them as these are commands that will run on start of the container which hold application.

Disclaimer

This is my first package, and I made it primarily because I caught myself doing same things on almost every project(copy -> pasting) so I wanted to save myself some time and created this. I also tweaked it a little, so it could be used in multiple occasions so maybe other people can use it. But keep in mind it was made having my problems in mind.

If you have any suggestion that would help you or things to add I would be happy to do it. If it helps one person I would be glad :).

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

usanzadunje/scaffold-laravel 适用场景与选型建议

usanzadunje/scaffold-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-30