PHPackages                             imjonos/laravel-base-service - 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. imjonos/laravel-base-service

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

imjonos/laravel-base-service
============================

Laravel base service

1.1.3(2mo ago)08724MITPHP

Since Nov 24Pushed 2mo ago1 watchersCompare

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

READMEChangelog (5)Dependencies (6)Versions (8)Used By (4)

📦 Laravel Base Service
======================

[](#-laravel-base-service)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c4fbf4476cb23efbae2d80c9ad8d29a8751572092622f54727ee028de0d9f39b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6a6f6e6f732f6c61726176656c2d626173652d736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/imjonos/laravel-base-service)
[![Total Downloads](https://camo.githubusercontent.com/7d7f5060cf94d8b3f2020eb595b80e3775f061900ba3c5445384e8a91748a1b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6a6f6e6f732f6c61726176656c2d626173652d736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/imjonos/laravel-base-service)

A **generic base service class** for Laravel projects that provides a consistent and reusable way to handle business logic and data access. It integrates with `laravel-base-repository` and simplifies working with Eloquent models by encapsulating common operations like create, read, update, delete (CRUD), pagination, and more.

---

🧩 Overview
----------

[](#-overview)

This package provides an abstract `BaseService` class that wraps around a repository and offers a clean interface for handling business logic in a structured and testable way. It is designed to be used in conjunction with the `laravel-base-repository` package, but it can also work with any custom repository implementing the required interface.

---

🛠 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require imjonos/laravel-base-service
```

> ✅ This package depends on `imjonos/laravel-base-repository`. Make sure it is installed in your project as well.

---

✅ Usage
-------

[](#-usage)

### 1. Create Your Service Class

[](#1-create-your-service-class)

Create a new service class that extends `BaseService` and specifies the repository class:

```
namespace App\Services;

use App\Repositories\OrderRepository;
use Nos\BaseService\BaseService;

class OrderService extends BaseService
{
    protected string $repositoryClass = OrderRepository::class;
}
```

### 2. Use the Service in a Controller or Other Logic

[](#2-use-the-service-in-a-controller-or-other-logic)

Inject the service and use its methods:

```
namespace App\Http\Controllers;

use App\Services\OrderService;
use Illuminate\Http\Request;

class OrderController extends Controller
{
    protected $orderService;

    public function __construct(OrderService $orderService)
    {
        $this->orderService = $orderService;
    }

    public function index()
    {
        $orders = $this->orderService->all();
        return view('orders.index', compact('orders'));
    }

    public function store(Request $request)
    {
        $order = $this->orderService->create($request->all());
        return redirect()->route('orders.show', $order->id);
    }
}
```

---

🔧 Available Methods
-------------------

[](#-available-methods)

MethodDescription`getRepository()`Returns the repository instance`all()`Get all records`count()`Count all records`find(int $modelId)`Find a record by ID`exists(int $modelId)`Check if a record exists`create(array $data)`Create a new record (throws exception on failure)`update(int $modelId, array $data)`Update a record by ID`delete(int $modelId)`Delete a record by ID`updateOrCreate(array $attributes, array $data)`Update or create a record`paginate(int $pageNumber, int $pageSize, callable $builderCallback)`Paginate results with optional query builder callback---

🌐 Project Structure
-------------------

[](#-project-structure)

```
vendor/
└── imjonos/
    └── laravel-base-service/
        ├── src/
        │   └── BaseService.php

```

---

📦 Requirements
--------------

[](#-requirements)

- PHP 8.0+
- Laravel 9+

---

🧪 Testing
---------

[](#-testing)

You can easily mock the service and its repository in your tests, which helps keep your application logic decoupled and improves test coverage.

---

📝 License
---------

[](#-license)

This package is open-sourced software licensed under the MIT license. Please see the [license file](license.md) for more information.

---

🚀 Contributing
--------------

[](#-contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance85

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

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 ~199 days

Recently: every ~265 days

Total

7

Last Release

75d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a691ecb149ac661add3a6229e3c545aaaa40bad4ae0fa9c0ad9464c79e86ff20?d=identicon)[Eugeny Nosenko](/maintainers/Eugeny%20Nosenko)

---

Top Contributors

[![imjonos](https://avatars.githubusercontent.com/u/5132976?v=4)](https://github.com/imjonos "imjonos (19 commits)")

---

Tags

laravelservice

### Embed Badge

![Health badge](/badges/imjonos-laravel-base-service/health.svg)

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

###  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)[getsolaris/laravel-make-service

A MVCS pattern create a service command for Laravel 5+

81161.3k](/packages/getsolaris-laravel-make-service)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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