iadewunmi/laravel-porto-sap
Composer 安装命令:
composer require iadewunmi/laravel-porto-sap
包简介
This package is a solution for easy building and working with Porto pattern structure
关键字:
README 文档
README
For Laravel [11.x] please use the latest [11.0] version.
This is a package who gives flexible way to build a structure of the Porto (Software Architectural Pattern) in your Laravel project. You should no longer to migrate a lot of files and folders handle.
This package will do the job for you in some clicks.
- Introduction
- How to install?
- Ship structure
- Containers
- Laravel console commands
- Make
- make:cast
- make:channel
- make:command
- make:component
- make:controller
- make:enum
- make:event
- make:exception
- make:factory
- make:job
- make:listener
- make:mail
- make:middleware
- make:model
- make:notification
- make:observer
- make:policy
- make:provider
- make:request
- make:resource
- make:rule
- make:scope
- make:seeder
- make:test
- Model
- Make
- Additional console commands
Introduction
Laravel is a popular and beautiful PHP framework who helps a lot to make your web applications. But web applications tend to grow and become harder to maintain and optimize. Unfortunately, Laravel, like other frameworks, does not have standard tools that allow you to write flexible, readable and easily maintainable code.
Porto (Software Architectural Pattern) is a brilliant solution for building large applications. This pattern helps you and your team to organize and maintain your code.
You can find more information about Porto by this link: https://github.com/Mahmoudz/Porto
How to install?
-
First of all you need to install the package:
composer require iadewunmi/laravel-porto-sap -
Next, you need to enable installed package in your .env file:
PORTO_SAP_ENABLED=true -
Next, you can install porto structure using this command:
php artisan porto:install --container=<Container Name> --container-<Container Type>You need to put directory path when the Porto structure will be installed or you can confirm installation in the default app/ directory.
Of course, if you put the custom directory path, you need to set it in the autoload -> psr-4 in the composer.json file.
You also can add directory name of your first container. For example:
--container=<Container Name>This container will be installed in the Containers directory with standard structure. You also can force another container structures like:
--container-default --container-api --container-cli --container-web --container-full -
Next, you need to put some changes in the bootstrap/app.php file.
From:
return [ App\Providers\AppServiceProvider::class, ];
-
That's all.
Below you can find the skeleton structure of ship, each type of containers and information about adapted laravel console commands.
Ship structure
This is a skeleton of the installed Ship structure.
Ship
├── Abstracts
│ ├── Broadcasting
│ │ ├── Channel.php
│ │ ├── PresenceChannel.php
│ │ └── PrivateChannel.php
│ │── Commands
│ │ └── ConsoleCommand.php
│ ├── Components
│ │ └── Component.php
│ ├── Controllers
│ │ └── Controller.php
│ ├── Events
│ │ └── Event.php
│ ├── Exceptions
│ │ └── Handler.php
│ ├── Factories
│ │ └── Factory.php
│ ├── Jobs
│ │ └── Job.php
│ ├── Mails
│ │ ├── Mailables
│ │ │ ├── Content.php
│ │ │ └── Envelope.php
│ │ └── Mailable.php
│ ├── Middleware
│ │ ├── Authenticate.php
│ │ ├── EncryptCookies.php
│ │ ├── PreventRequestsDuringMaintenance.php
│ │ ├── TrimStrings.php
│ │ ├── TrustHosts.php
│ │ ├── TrustProxies.php
│ │ ├── ValidateSignature.php
│ │ └── VerifyCsrfToken.php
│ ├── Models
│ │ ├── BaseModel.php
│ │ ├── UserModel.php
│ │ ├── Pivot.php
│ │ ├── MorphPivot.php
│ │ └── Builder.php
│ ├── Notifications
│ │ ├── Messages
│ │ │ └── MailMessage.php
│ │ └── Notification.php
│ ├── Policies
│ │ └── Policy.php
│ ├── Providers
│ │ ├── AuthServiceProvider.php
│ │ ├── ServiceProvider.php
│ │ ├── EventServiceProvider.php
│ │ └── RouteServiceProvider.php
│ ├── Requests
│ │ ├── Request.php
│ │ └── FormRequest.php
│ ├── Responses
│ │ ├── Response.php
│ │ ├── RedirectResponse.php
│ │ └── JsonResource.php
│ ├── Resources
│ │ └── ResourceCollection.php
│ ├── Seeders
│ │ └── Seeder.php
│ ├── Tests
│ │ └── PhpUnit
│ │ └── TestCase.php
│ ├── Translations
│ │ └── PotentiallyTranslatedString.php
│ └── Views
│ └── Component.php
├── Broadcasting
│ ├── Channel.php
│ ├── PresenceChannel.php
│ └── PrivateChannel.php
├── Commands
├── Configs
├── Controllers
│ └── Controller.php
├── Events
│ └── Event.php
├── Exceptions
│ └── Handler.php
├── Helpers
│ └── helper.php
├── Kernels
│ ├── ConsoleKernel.php
│ └── HttpKernel.php
├── Mails
│ └── Mailables
│ ├── Envelope.php
│ └── Content.php
├── Middleware
│ ├── Authenticate.php
│ ├── EncryptCookies.php
│ ├── PreventRequestsDuringMaintenance.php
│ ├── RedirectIfAuthenticated.php
│ ├── TrimStrings.php
│ ├── TrustHosts.php
│ ├── TrustProxies.php
│ ├── ValidateSignature.php
│ └── VerifyCsrfToken.php
├── Migrations
├── Models
│ ├── Model.php
│ ├── UserModel.php
│ ├── Pivot.php
│ ├── MorphPivot.php
│ ├── Builder.php
│ └── Scope.php
├── Notifications
│ ├── Messages
│ │ └── MailMessage.php
│ └── Notification.php
├── Policies
│ └── Policy.php
├── Providers
│ ├── AuthServiceProvider.php
│ ├── BroadcastServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── Requests
│ ├── Request.php
│ └── FormRequest.php
├── Responses
│ ├── Response.php
│ └── RedirectResponse.php
├── Resources
│ ├── JsonResource.php
│ └── ResourceCollection.php
├── Seeders
├── Tests
│ └── TestCase.php
├── Traits
│ └── CreatesApplication.php
└── Translations
Containers
1. Standard
To create container with necessary files and folders you need to put this command:
php artisan make:container <Name>
Without forced container type will be created standard container structure.
Standard Container's Structure
Container
├── Actions
├── Tasks
├── Models
├── Loaders
│ ├── AliasesLoader.php
│ ├── ProvidersLoader.php
│ └── MiddlewareLoader.php
└── UI
├── WEB
│ ├── Routes
│ ├── Controllers
│ └── Views
├── API
│ ├── Routes
│ ├── Controllers
│ └── Transformers
└── CLI
├── Routes
└── Commands
2. Default
To create container with default route, controller, view and test file you can via command below:
php artisan make:container <Name> --default
Default Container's Structure
Container
├── Actions
├── Tasks
├── Models
├── Loaders
│ ├── AliasesLoader.php
│ ├── ProvidersLoader.php
│ └── MiddlewareLoader.php
└── UI
├── WEB
│ ├── Routes
│ │ ├── home.php
│ ├── Controllers
│ │ ├── HomeController.php
│ ├── Views
│ │ ├── home.blade.php
│ ├── Tests
│ │ ├── Functional
│ └── └── └── ExampleTest.php
├── API
│ ├── Routes
│ ├── Controllers
│ └── Transformers
└── CLI
├── Routes
└── Commands
3. API
To create container only for API needles you can via command below:
php artisan make:container <Name> --api
API Container's Structure
Container
├── Actions
├── Tasks
├── Models
├── Loaders
│ ├── AliasesLoader.php
│ ├── ProvidersLoader.php
│ └── MiddlewareLoader.php
└── UI
└── API
├── Routes
├── Controllers
└── Transformers
4. CLI
To create container only for command line interface needles you can via command below:
php artisan make:container <Name> --cli
CLI Container's Structure
Container
├── Actions
├── Tasks
├── Models
├── Loaders
│ ├── AliasesLoader.php
│ ├── ProvidersLoader.php
│ └── MiddlewareLoader.php
└── UI
└── CLI
├── Routes
└── Commands
5. WEB
To create container only for web needles you can via command below:
php artisan make:container <Name> --web
WEB Container's Structure
Container
├── Actions
├── Tasks
├── Models
├── Loaders
│ ├── AliasesLoader.php
│ ├── ProvidersLoader.php
│ └── MiddlewareLoader.php
└── UI
└── WEB
├── Routes
├── Controllers
└── Views
6. Full
To create container with full structure you can via command below:
php artisan make:container <Name> --full
Full Container's Structure
Container
├── Actions
├── Tasks
├── Models
├── Values
├── Events
├── Listeners
├── Policies
├── Exceptions
├── Contracts
├── Traits
├── Enums
├── Jobs
├── Notifications
├── Providers
├── Configs
├── Loaders
│ ├── AliasesLoader.php
│ ├── ProvidersLoader.php
│ └── MiddlewareLoader.php
├── Mails
│ └── Templates
├── Data
│ ├── Migrations
│ ├── Seeders
│ ├── Factories
│ ├── Criteria
│ ├── Repositories
│ ├── Validators
│ ├── Transporters
│ └── Rules
├── Tests
│ ├── Traits
│ └── Unit
└── UI
├── WEB
│ ├── Routes
│ ├── Controllers
│ ├── Requests
│ ├── Tests
│ │ └── Functional
│ └── Views
├── API
│ ├── Routes
│ ├── Controllers
│ ├── Requests
│ ├── Tests
│ │ └── Functional
│ └── Transformers
└── CLI
├── Routes
├── Commands
└── Tests
└── Functional
Laravel console commands
1. Make
This is a list of adapted laravel console commands for the Porto.
Without container name some commands will be created class in the Ship.
Other commands require the container name
make:cast
php artisan make:cast <Name> --container=<Container Name>
make:channel
php artisan make:channel <Name> --container=<Container Name>
make:command
php artisan make:command <Name>
php artisan make:command <Name> --container=<Container Name>
make:component
php artisan make:component <Name> --container=<Container Name>
make:controller
php artisan make:controller <Name> --container=<Container Name>
make:enum
php artisan make:enum <Name> --container=<Container Name>
make:event
php artisan make:event <Name>
php artisan make:event <Name> --container=<Container Name>
make:exception
php artisan make:exception <Name>
php artisan make:exception <Name> --container=<Container Name>
make:factory
php artisan make:factory <Name> --container=<Container Name>
make:job
php artisan make:job <Name>
php artisan make:job <Name> --container=<Container Name>
make:listener
php artisan make:listener <Name> --container=<Container Name>
make:mail
php artisan make:mail <Name>
php artisan make:mail <Name> --container=<Container Name>
make:middleware
php artisan make:middleware <Name>
php artisan make:middleware <Name> --container=<Container Name>
make:model
php artisan make:model <Name> --container=<Container Name>
make:notification
php artisan make:notification <Name>
php artisan make:notification <Name> --container=<Container Name>
make:observer
php artisan make:observer <Name> --container=<Container Name>
make:policy
php artisan make:policy <Name> --container=<Container Name>
make:provider
php artisan make:provider <Name>
php artisan make:provider <Name> --container=<Container Name>
make:request
php artisan make:request <Name> --container=<Container Name> --uiType=api
php artisan make:request <Name> --container=<Container Name> --uiType=web
make:resource
php artisan make:resource <Name> --container=<Container Name>
make:rule
php artisan make:rule <Name> --container=<Container Name>
make:scope
php artisan make:scope <Name> --container=<Container Name>
make:seeder
php artisan make:seeder <Name>
php artisan make:seeder <Name> --container=<Container Name>
make:test
php artisan make:test <Name> --container=<Container Name> --uiType=api
php artisan make:test <Name> --container=<Container Name> --uiType=cli
php artisan make:test <Name> --container=<Container Name> --uiType=web
2. Model
make:show
php artisan make:show --container=<Container Name>
Additional console commands
1. Make
This is a list of console commands for the Porto who does not exists in Laravel.
Without container name some commands will be created class in the Ship.
Other commands require the container name
make:action
php artisan make:action <Name> --container=<Container Name>
make:config
php artisan make:config <Name>
php artisan make:config <Name> --container=<Container Name>
make:contract
php artisan make:contract <Name> --container=<Container Name>
make:helper
php artisan make:helper <Name>
make:repository
php artisan make:repository <Name>
make:task
php artisan make:task <Name> --container=<Container Name>
make:trait
php artisan make:trait <Name> --container=<Container Name>
php artisan make:trait <Name> --container=<Container Name> --test
make:translation
php artisan make:translation <Name> --lang=<lang code>
make:value
php artisan make:value <Name> --container=<Container Name>
License
Released under the MIT License, see LICENSE.
iadewunmi/laravel-porto-sap 适用场景与选型建议
iadewunmi/laravel-porto-sap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「template」 「pattern」 「laravel」 「architecture」 「Porto」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 iadewunmi/laravel-porto-sap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 iadewunmi/laravel-porto-sap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 iadewunmi/laravel-porto-sap 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package for the Repository Design Pattern.
Inbox pattern process implementation for your Laravel Applications
Simple ASCII output of array data
E2E Studios PHP Framework adaptation of leafsphp/blade package
A library for simple pattern matching.
Rinvex Repository is a simple, intuitive, and smart implementation of Active Repository with extremely flexible & granular caching system for Laravel, used to abstract the data layer, making applications more flexible to maintain.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-21