定制 salah3id/address-domains 二次开发

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

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

salah3id/address-domains

Composer 安装命令:

composer require salah3id/address-domains

包简介

Laravel Domain management

README 文档

README

Latest Version on Packagist Software License Scrutinizer Coverage Quality Score Total Downloads

Laravel address-domains
9.0 ^1.0

salah3id/address-domains is a Laravel package which created to manage your large Laravel app using domains with repository design pattern to abstract the data layer, making our application more flexible to maintain. Domain is like a Laravel package, it has some views, controllers or models. This package is supported and tested in Laravel 9.

This package is a re-published, re-organised of nWidart/laravel-modules, which isn't support repository design pattern.

Install

To install through Composer, by run the following command:

composer require salah3id/address-domains

The package will automatically register a service provider and alias.

Optionally, publish the package's configuration file by running:

php artisan vendor:publish --provider="Salah3id\Domains\LaravelDomainsServiceProvider"

Autoloading

By default, the domain classes are not loaded automatically. You can autoload your domains using psr-4. For example:

{
  "autoload": {
    "psr-4": {
      "App\\": "app/",
      "Domains\\": "Domains/",
      "Database\\Factories\\": "database/factories/",
      "Database\\Seeders\\": "database/seeders/"
  }

}

Tip: don't forget to run composer dump-autoload afterwards.

Creating a Domain

Generate your first domain using :

  php artisan domain:make Address

The following structure will be generated.

app/
bootstrap/
vendor/
Domains/
│   ├── Address/             
│   │   ├── Assets/             
│   │   ├── Config/             
│   │   ├── Console/             
│   │   ├── Database/
│   │   │   ├── Migrations/ 
│   │   │   ├── Seeders/
│   │   ├── Entities/
│   │   ├── Http/
│   │   │   ├── Controllers/
│   │   │   ├── Middleware/
│   │   │   ├── Requests/
│   │   ├── Providers/
│   │   │   ├── AddressServiceProvider.php
│   │   │   ├── RepositoryServiceProvider.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     
│   │   └──
│   └── Other Domains ...                    
└── ... etc 

Generate multiple domains using :

  php artisan domain:make Address User Admin Blog

domain:make command options

Parameter Description
--plain , -p By default when you create a new domain, the command will add some resources like a controller, seed class, service provider, etc. automatically. If you don't want these, you can add --plain flag, to generate a plain domain.

Naming convention

Because we are autoloading the modules using psr-4, we strongly recommend using StudlyCase convention.

Utility commands

domain:make

Generate a new domain

  php artisan domain:make Address

domain:make

Generate multiple domains at once.

  php artisan domain:make Address User Admin 

domain:use

This allows you to not specify the doamin name on other commands requiring the module name as an argument.

  php artisan domain:use Address 

domain:unuse

This unsets the specified domain that was set with the domain:use command.

  php artisan domain:unuse Address 

domain:list

List all available domains.

  php artisan domain:list 

domain:migrate

Migrate the given domain, or without a domain an argument, migrate all domains.

  php artisan domain:migrate Address

domain:migrate-rollback

Rollback the given domain, or without an argument, rollback all domains.

  php artisan domain:migrate-rollback Address

domain:migrate-refresh

Refresh the migration for the given module, or without a specified module refresh all modules migrations.

  php artisan domain:migrate-refresh Address

domain:migrate-reset

Reset the migration for the given domain, or without a specified domain reset all domains migrations.

php artisan domain:migrate-reset Address

domain:seed

Seed the given domain, or without an argument, seed all domains

php artisan domain:seed Address

domain:publish-migration

Publish the migration files for the given domain, or without an argument publish all domains migrations.

php artisan domain:publish-migration Address

domain:publish-config

Publish the given domain configuration files, or without an argument publish all domains configuration files.

php artisan domain:publish-config Address

domain:publish-translation

Publish the translation files for the given domain, or without a specified domain publish all domains migrations.

php artisan domain:publish-translation Address

domain:enable

Enable the given domain.

php artisan domain:enable Address

domain:disable

Disable the given domain.

php artisan domain:disable Address

domain:update

Update the given domain.

php artisan module:update Blog

Credits

License

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

salah3id/address-domains 适用场景与选型建议

salah3id/address-domains 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 85 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 12 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 salah3id/address-domains 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-13