mitul456/laravel-repository-service
Composer 安装命令:
composer require mitul456/laravel-repository-service
包简介
A Laravel package to generate repository and service layers using artisan commands
README 文档
README
A powerful Laravel package to automatically generate Repository and Service layers, helping you build clean, maintainable, and testable applications.
🇧🇩 বাংলা: এটি একটি Laravel প্যাকেজ যা Repository Pattern এবং Service Layer স্বয়ংক্রিয়ভাবে তৈরি করে, আপনার কোডকে আরও ক্লিন এবং মেইন্টেইনেবল করে তোলে।
⚡ Quick Start
Install the package via Composer:
composer require mitul456/laravel-repository-service php artisan make:repository UserRepository php artisan make:service UserService
✨ Features
- 🚀 Auto generate Repository and Service classes
- 📦 Base repository trait with common CRUD operations
- 🔧 Generate Repository or Service separately
- 💉 Dependency Injection ready
- 📝 Configurable namespaces and paths
- 🎯 PSR-4 compliant
- 🎨 Clean architecture friendly
🤔 Why use this package?
- Keep controllers clean and focused
- Separate business logic from controllers
- Improve code maintainability
- Make testing easier
- Follow clean architecture principles
📋 Requirements
- PHP ^8.0 or higher
- Laravel ^10.0 or ^11.0
- Composer
🔧 Installation
Install the package via Composer:
composer require mitul456/laravel-repository-service
Auto Discovery
This package supports Laravel auto-discovery. No need to manually register any service provider.
⚙️ Configuration
If you want to customize namespaces or paths, publish the config file:
php artisan vendor:publish --tag=repository-service-config
🚀 Usage
1. Create Repository and Service Together
php artisan make:repository-service User
📌 Example Usage
Repository Example
class UserRepository { public function getAll() { return User::all(); } }
Service Example
class UserService { protected $repository; public function __construct(UserRepository $repository) { $this->repository = $repository; } public function getUsers() { return $this->repository->getAll(); } }
Controller Example
class UserController extends Controller { protected $service; public function __construct(UserService $service) { $this->service = $service; } public function index() { return $this->service->getUsers(); } }
📁 Directory Structure
Example structure generated by the package:
app/
├── Repositories/
│ └── UserRepository.php
├── Services/
│ └── UserService.php
🧪 Testing
Run your Laravel tests:
php artisan test
⚠️ Troubleshooting
- Run
composer dump-autoloadif classes are not found - Ensure correct namespace configuration
- Check Laravel version compatibility
🤝 Contributing
Contributions are welcome!
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
📄 License
This package is open-sourced software licensed under the MIT license.
mitul456/laravel-repository-service 适用场景与选型建议
mitul456/laravel-repository-service 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「service layer」 「laravel」 「clean architecture」 「repository pattern」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mitul456/laravel-repository-service 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mitul456/laravel-repository-service 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mitul456/laravel-repository-service 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
ADOdb is a PHP database abstraction layer library
A fast and intuitive dependency injection container.
Registry service.
swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations
Service auto install for Nette Framework
Structure for the Laravel Service-Repository Pattern
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 38
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-04