PHPackages                             pros/base - 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. pros/base

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

pros/base
=========

let's build the Pros base style

0.1.1(4y ago)481[1 issues](https://github.com/proteanstudios/laravel-code-base/issues)MITPHP

Since Nov 17Pushed 4y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (4)Used By (0)

Purpose
=======

[](#purpose)

This library is for convenient methods that use to register code base for Laravel project

Target
======

[](#target)

We aimed to reduce complexity for real projects with MVC plus Repository and Service layers. The struct was tested by our real projects, and it reduces complexity significantly, also easy to debug, more readable.

The struct forcus on creating Repository and Service for Laravel project version 8.0 and up.

Therefore:

- The Repository aimed to interact with Model, a Repository has only one Model instance. When creating new Repository, it automatically detects the Model. For exam: `UserRepository` will auto take `User` as the Model.
- Service aimed to resolve logic. So your controller just need to pass params to Service, that's all.
- ApiLogicException helps throwing exception whenever your API faces one.
- ResponseTemplateTrait is a standard for json response, you won't need to repeat your code anymore, just call.

Installation
============

[](#installation)

```
composer require pros/base

```

Commands
========

[](#commands)

The lib supports 3 commands:

- `php artisan make:remose ` to generate Repository, Model, Service base on `name`.

    For exam: `php artisan make:remose User` will generate:

    - `Models/User.php`
    - `Repositories/UserRepository.php`
    - `Services/UserService.php`
- `php artisan make:repo ` to generate Repository
- `php artisan make:service ` to generate Service

Example
=======

[](#example)

- `Controller.php`

```
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    // this line is to register json response convenient methods
    use ResponseTemplateTrait;

    pubic function __construct(
        protected Service $service
    ){}

    public function index(Request $request)
    {
        $param1 = $request->get('param1');
        $data = $this->service->methodName($param1)

        // this method comes from ResponseTemplateTrait
        // it also contains jsonError and jsonSuccessNoContent methods
        return $this->jsonSuccess($data);
    }
}

```

- `Service.php`

```
class Service
{
    pubic function __construct(
        protected Repository $repository
    ){}

    /**
    * for testing only, it can be whatever
    */
    public function methodName($param1) : boolean
    {
        // This is for demo only,
        // you can throw new exception to avoid check error
        // here and there.
        // It helps code more readable.
        // But it doesn't limit you in returning error, both are fine
        if('a' === 'b') {
            throw new ApiLogicException('What the hell?');
        }

        // handle your code logic here and then interact with DB
        // via repository
        return $this->repository->paramExists($param1);
    }
}

```

- `Repository.php`

```
class Repostory extends BaseRepository
{
    public funtion paramExists($param) : boolean
    {
        // $this can represents for Model, Eloquent, QueryBuilder
        // so feel free to use this as you desired
        // you also can use $this->model for same purpose.
        return $this->where('a' = $param)->exists();
    }
}

```

License
=======

[](#license)

MIT for a lifetime, if you got next life then you have to pay ;)

Contacts
========

[](#contacts)

-

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Total

2

Last Release

1627d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/34319b1413375180dd6839901054c8930db527056167723e11419ade34adc399?d=identicon)[pros](/maintainers/pros)

---

Top Contributors

[![crazyfree](https://avatars.githubusercontent.com/u/3860469?v=4)](https://github.com/crazyfree "crazyfree (9 commits)")

### Embed Badge

![Health badge](/badges/pros-base/health.svg)

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

###  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)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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