PHPackages                             fadyreda99/laravel-service-repository-maker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fadyreda99/laravel-service-repository-maker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fadyreda99/laravel-service-repository-maker
===========================================

Generate Service + Repository + Module with optional model CRUD

v1.0.4(5mo ago)06MITPHPPHP &gt;=8.0

Since Dec 1Pushed 5mo agoCompare

[ Source](https://github.com/fadyreda99/laravel-service-repository-maker)[ Packagist](https://packagist.org/packages/fadyreda99/laravel-service-repository-maker)[ RSS](/packages/fadyreda99-laravel-service-repository-maker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

📦 Laravel Service &amp; Repository Maker
========================================

[](#-laravel-service--repository-maker)

A powerful Laravel package that automatically generates **Services**, **Repositories**, and full **Modules** with optional CRUD scaffolding.
This package helps you apply clean architecture, avoid repeating boilerplate code, and speed up development significantly.

---

🚀 Features
==========

[](#-features)

✔ Generate **Service**, **Repository**, or both together as a **Module**
✔ Auto‑generate CRUD logic when passing a model
✔ Support for namespaced paths (`Admin/User`, `Api/V1/Product`, …)
✔ Works with Laravel **8 / 9 / 10 / 11 / 12**
✔ Zero configuration — just install and use
✔ Generates clean, organized architecture

Folder structure produced:

```
app/
 ├── Services/
 │     └── UserService.php
 └── Repositories/
       └── UserRepository.php

```

---

📥 Installation
==============

[](#-installation)

Install via Composer:

```
composer require fadyreda99/laravel-service-repository-maker
```

Laravel auto‑discovers the provider — no manual setup needed.

---

🛠 Artisan Commands
==================

[](#-artisan-commands)

The package provides **3 main commands**:

---

1️⃣ Create a Repository
-----------------------

[](#1️⃣-create-a-repository)

```
php artisan make:repository UserRepository --model=User

```

Output:

```
app/Repositories/UserRepository.php

```

### ⭐ Generated Repository (when model is provided)

[](#-generated-repository-when-model-is-provided)

```
public function allWithCondition(array $condition = [], array $with = [], bool $paginated = false, int $limit = 10, array $orderBy = [])
{
    $query = User::with($with)->where($condition);

    foreach ($orderBy as $col => $dir) {
        $query->orderBy($col, $dir);
    }

    return $paginated ? $query->paginate($limit) : $query->get();
}

public function find(int $id, array $with = [], array $condition = [])
{
    return User::with($with)->where($condition)->where('id', $id)->first();
}

public function create(array $data)
{
    return User::create($data);
}

public function update(int $id, array $data)
{
    $record = User::findOrFail($id);
    $record->update($data);
    return $record;
}

public function delete(int $id, array $condition = [])
{
    return (bool) User::where($condition)->where('id', $id)->delete();
}
```

---

### 🧱 Repository generated WITHOUT model

[](#-repository-generated-without-model)

If you run the command **without** `--model`:

```
php artisan make:repository ReportRepository

```

Generated file:

```
class ReportRepository
{
    // Add repository methods here
}
```

Perfect when creating a repository with custom logic.

---

2️⃣ Create a Service
--------------------

[](#2️⃣-create-a-service)

```
php artisan make:service UserService --model=User

```

Output:

```
app/Services/UserService.php

```

### ⭐ Generated Service (when model is provided)

[](#-generated-service-when-model-is-provided)

```
public function allWithCondition($request)
{
    $data = $request->all();
    $condition = [];
    $with = [];
    $paginated =  false;
    $limit = 10;
    $orderBy = [];

    return $this->repository->allWithCondition($condition, $with, $paginated, $limit, $orderBy);
}

 public function find($request)
    {
        $data = $request->all();
        $id = $data['id'];
        $condition = [];
        $with = [];
        return $this->repository->find($id, $with, $condition);
    }

public function create($request)
{
    return $this->repository->create($request->all());
}

public function update($request)
{
    return $this->repository->update($request->input('id'), $request->all());
}

 public function delete($request)
    {
        $data = $request->all();
        $id = $data['id'];
        $condition = [];
        return $this->repository->delete($id, $condition);
    }
```

---

### 🧱 Service generated WITHOUT model

[](#-service-generated-without-model)

```
php artisan make:service ReportService

```

Produces:

```
class ReportService
{
    // Service methods
}
```

Use it for services that do not depend on a specific model.

---

3️⃣ Create a Full Module (Service + Repository)
-----------------------------------------------

[](#3️⃣-create-a-full-module-service--repository)

```
php artisan make:module User --model=User

```

Output:

```
app/Services/UserService.php
app/Repositories/UserRepository.php

```

Both files include fully‑functional CRUD logic.

---

🧪 Example: Using the Generated Service in a Controller
======================================================

[](#-example-using-the-generated-service-in-a-controller)

```
use App\Services\UserService;

class UserController extends Controller
{
    public function __construct(private UserService $service) {}

    public function index(Request $request)
    {
        return $this->service->allWithCondition($request);
    }

    public function store(Request $request)
    {
        return $this->service->create($request);
    }
}
```

---

📌 Namespaced Paths Example
==========================

[](#-namespaced-paths-example)

You can generate into nested folders:

```
php artisan make:module Admin/User --model=User

```

Outputs:

```
app/Services/Admin/UserService.php
app/Repositories/Admin/UserRepository.php

```

---

📝 Requirements
==============

[](#-requirements)

- PHP 8.0+
- Laravel 8–12

---

📄 License
=========

[](#-license)

This package is open‑source and licensed under the **MIT License**.

---

❤️ Contributing
===============

[](#️-contributing)

Pull requests are welcome!
Feel free to open issues for improvements and ideas.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance71

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

162d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a531d35d2b3f9c22fac568e8955acb2b8f7933bce328e7f63139cad3a7288b5?d=identicon)[fadyreda99](/maintainers/fadyreda99)

---

Top Contributors

[![fadyreda99](https://avatars.githubusercontent.com/u/130838390?v=4)](https://github.com/fadyreda99 "fadyreda99 (8 commits)")

### Embed Badge

![Health badge](/badges/fadyreda99-laravel-service-repository-maker/health.svg)

```
[![Health](https://phpackages.com/badges/fadyreda99-laravel-service-repository-maker/health.svg)](https://phpackages.com/packages/fadyreda99-laravel-service-repository-maker)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
