{"id":37335486,"url":"https://github.com/getsolaris/laravel-make-service","last_synced_at":"2026-01-17T12:50:26.319Z","repository":{"id":38007422,"uuid":"153322909","full_name":"getsolaris/laravel-make-service","owner":"getsolaris","description":":rocket: Create a service layer for Laravel 5+","archived":false,"fork":false,"pushed_at":"2025-06-30T04:05:06.000Z","size":54,"stargazers_count":81,"open_issues_count":0,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-16T13:36:45.122Z","etag":null,"topics":["laravel","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getsolaris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-10-16T17:03:37.000Z","updated_at":"2026-01-15T13:53:20.000Z","dependencies_parsed_at":"2024-02-28T10:29:59.883Z","dependency_job_id":"f63e01e1-4ae6-4e70-be85-14f11b7abe02","html_url":"https://github.com/getsolaris/laravel-make-service","commit_stats":{"total_commits":59,"total_committers":9,"mean_commits":6.555555555555555,"dds":"0.35593220338983056","last_synced_commit":"80e6d6e050e2e526903d05613adf34a30ae27e99"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/getsolaris/laravel-make-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsolaris%2Flaravel-make-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsolaris%2Flaravel-make-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsolaris%2Flaravel-make-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsolaris%2Flaravel-make-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getsolaris","download_url":"https://codeload.github.com/getsolaris/laravel-make-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsolaris%2Flaravel-make-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","php"],"created_at":"2026-01-16T03:45:05.590Z","updated_at":"2026-01-17T12:50:26.304Z","avatar_url":"https://github.com/getsolaris.png","language":"PHP","readme":"# Laravel Make Service\n\n[![Latest Stable Version](http://poser.pugx.org/getsolaris/laravel-make-service/v)](https://packagist.org/packages/getsolaris/laravel-make-service)\n[![Total Downloads](http://poser.pugx.org/getsolaris/laravel-make-service/downloads)](https://packagist.org/packages/getsolaris/laravel-make-service)\n[![Monthly Downloads](http://poser.pugx.org/getsolaris/laravel-make-service/d/monthly)](https://packagist.org/packages/getsolaris/laravel-make-service)\n[![License](http://poser.pugx.org/getsolaris/laravel-make-service/license)](https://packagist.org/packages/getsolaris/laravel-make-service)\n[![PHP Version Require](http://poser.pugx.org/getsolaris/laravel-make-service/require/php)](https://packagist.org/packages/getsolaris/laravel-make-service)\n\nA Laravel package that provides an Artisan command to generate service classes, implementing the MVCS (Model-View-Controller-Service) pattern in your Laravel applications.\n\n## Overview\n\nThis package simplifies the creation of service layer classes in Laravel applications. It helps you maintain clean architecture by separating business logic from controllers, making your code more maintainable, testable, and reusable.\n\n## Requirements\n\n- PHP 7.1 or higher\n- Laravel 5.6.34 or higher (supports up to Laravel 12)\n\n## Installation\n\nInstall the package via Composer:\n\n```bash\ncomposer require getsolaris/laravel-make-service --dev\n```\n\nThe package will automatically register itself using Laravel's package discovery.\n\n## Usage\n\n### Basic Command Syntax\n\n```bash\nphp artisan make:service {name} {--i : Create a service interface}\n```\n\n### Creating a Service Class\n\nTo create a simple service class:\n\n```bash\nphp artisan make:service UserService\n```\n\nThis will create a service class at `app/Services/UserService.php`:\n\n```php\n\u003c?php\n\nnamespace App\\Services;\n\nclass UserService\n{\n    //\n}\n```\n\n### Creating a Service with Interface\n\nTo create a service class with its corresponding interface:\n\n```bash\nphp artisan make:service UserService --i\n```\n\nThis will create two files:\n\n1. **Service class** at `app/Services/UserService.php`:\n```php\n\u003c?php\n\nnamespace App\\Services;\n\nuse App\\Services\\Interfaces\\UserServiceInterface;\n\nclass UserService implements UserServiceInterface\n{\n    //\n}\n```\n\n2. **Interface** at `app/Services/Interfaces/UserServiceInterface.php`:\n```php\n\u003c?php\n\nnamespace App\\Services\\Interfaces;\n\ninterface UserServiceInterface\n{\n    //\n}\n```\n\n## Practical Examples\n\n### Example Service Implementation\n\n```php\n\u003c?php\n\nnamespace App\\Services;\n\nuse App\\Models\\User;\nuse App\\Services\\Interfaces\\UserServiceInterface;\nuse Illuminate\\Support\\Facades\\DB;\nuse Illuminate\\Support\\Facades\\Hash;\n\nclass UserService implements UserServiceInterface\n{\n    /**\n     * Create a new user\n     *\n     * @param array $data\n     * @return User\n     */\n    public function createUser(array $data): User\n    {\n        return DB::transaction(function () use ($data) {\n            return User::create([\n                'name' =\u003e $data['name'],\n                'email' =\u003e $data['email'],\n                'password' =\u003e Hash::make($data['password']),\n            ]);\n        });\n    }\n\n    /**\n     * Update user information\n     *\n     * @param User $user\n     * @param array $data\n     * @return bool\n     */\n    public function updateUser(User $user, array $data): bool\n    {\n        if (isset($data['password'])) {\n            $data['password'] = Hash::make($data['password']);\n        }\n\n        return $user-\u003eupdate($data);\n    }\n\n    /**\n     * Get user statistics\n     *\n     * @param User $user\n     * @return array\n     */\n    public function getUserStatistics(User $user): array\n    {\n        return [\n            'posts_count' =\u003e $user-\u003eposts()-\u003ecount(),\n            'comments_count' =\u003e $user-\u003ecomments()-\u003ecount(),\n            'last_login' =\u003e $user-\u003elast_login_at,\n        ];\n    }\n}\n```\n\n### Using Services in Controllers\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Requests\\StoreUserRequest;\nuse App\\Http\\Requests\\UpdateUserRequest;\nuse App\\Services\\UserService;\nuse Illuminate\\Http\\JsonResponse;\n\nclass UserController extends Controller\n{\n    protected UserService $userService;\n\n    public function __construct(UserService $userService)\n    {\n        $this-\u003euserService = $userService;\n    }\n\n    public function store(StoreUserRequest $request): JsonResponse\n    {\n        $user = $this-\u003euserService-\u003ecreateUser($request-\u003evalidated());\n\n        return response()-\u003ejson([\n            'message' =\u003e 'User created successfully',\n            'user' =\u003e $user\n        ], 201);\n    }\n\n    public function update(UpdateUserRequest $request, User $user): JsonResponse\n    {\n        $this-\u003euserService-\u003eupdateUser($user, $request-\u003evalidated());\n\n        return response()-\u003ejson([\n            'message' =\u003e 'User updated successfully',\n            'user' =\u003e $user-\u003efresh()\n        ]);\n    }\n\n    public function statistics(User $user): JsonResponse\n    {\n        $stats = $this-\u003euserService-\u003egetUserStatistics($user);\n\n        return response()-\u003ejson($stats);\n    }\n}\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Support\n\nIf you discover any issues or have questions, please [create an issue](https://github.com/getsolaris/laravel-make-service/issues).\n\n## Author\n\n- **Solaris** - [getsolaris](https://github.com/getsolaris)\n- Email: getsolaris.kr@gmail.com\n\n## License\n\nThis package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsolaris%2Flaravel-make-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetsolaris%2Flaravel-make-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsolaris%2Flaravel-make-service/lists"}