Download the PHP package adobrovolsky97/laravel-repository-service-pattern without Composer

On this page you can find all versions of the php package adobrovolsky97/laravel-repository-service-pattern. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-repository-service-pattern

Laravel 5.x - 11.x Repository-Service Pattern

The repository service pattern in Laravel is a widely used architectural pattern that provides a structured approach to accessing and managing data in an application. It serves as an intermediary layer between the application's business logic and the underlying data storage mechanism, such as a database.

The purpose of using the repository service pattern in Laravel is to decouple the application's business logic from the specific implementation details of data storage. By doing so, it promotes code reusability, maintainability, and testability. The pattern achieves this by defining a set of interfaces or contracts that represent the operations and queries related to data access.

Here are some key purposes and benefits of using the repository service pattern in Laravel:

Overall, the repository service pattern in Laravel provides a structured and flexible approach to managing data access in applications, contributing to better code organization, maintainability, and testability.

Supports soft delete functionality (via trait or custom column).

Supports composite model keys.

Installation

Composer

Execute the following command to get the latest version of the package:

Methods

Adobrovolsky97\LaravelRepositoryServicePattern\Repositories\Contracts\BaseRepositoryInterface

Adobrovolsky97\LaravelRepositoryServicePattern\Repositories\Contracts\BaseCachableRepositoryInterface

This one supports the same methods, the only difference that it supports caching models & collections

Adobrovolsky97\LaravelRepositoryServicePattern\Services\Contracts\BaseCrudServiceInterface

Usage

Create a Model

Create your model e.g Post

Create Repository

Create Service

Link Service to its contract in ServiceProvider

Now the Service is ready for work.

Use methods

CRUD Controller Actions Example

Index

Show

Store

Update

Destroy

Restore

Soft Deletes

You need to add at least soft delete column (deleted_at) to the table to start using soft deletes from the service.

Also, it is possible to use it together with SoftDeletes trait

By default soft delete column name is deleted_at, you may override it by defining variable inside your repository

protected $deletedAtColumnName = 'custom_deleted_at';

By default, soft deleted records excluded from the query result data

Showing only soft deleted records

Showing only NOT soft deleted records

Loading the Model relationships

Query results filtering

By default filtering will be handled by applyFilterConditions(), but you may probably need to do custom filtering, so override applyFilters method in your repository if you need custom filtering

Find many models by multiple fields

Caching

If you want to apply caching to your models - extend your entity repository with the BaseCacheableRepository.php

Code Generator

Allows generating Classes/Interfaces/Traits

$template = new ClassTemplate();

$template->setType('class')->setName('ClassName')->setNamespace('Path\\To\\Class');

It is possible define properties, methods, constants, extends, implements, doc block comments, create abstract/final classes, set method body, etc...

Eloquent Model Generation Feature

Command php artisan generate:model {table} - generates the model for the table, define all relations, properties, define doc block with props annotations. (will not override model if the one already exists)

Repository-Service pattern files generation

Command php artisan generate:repository-service {table} generates repository and service for a model (will not override model if the one already exists)

Requests generation

Command php artisan generate:request {tableAndNamespace} {modelNamespace?} will generate a Request instance,

Resource generation

Command php artisan generate:resource {table} generates resource for a particular Model by table name (will not override model if the one already exists)

Api Resource Controller generation

Command php artisan generate:resource-controller {table} will generate a resource controller for a particular Model entity by table name (will not override model if the one already exists)

The controller actions will be based on the Repository-Service laravel pattern package;

CRUD generation

Command php artisan generate:crud {table} will generate all entities mentioned above (will not override model if the one already exists)


All versions of laravel-repository-service-pattern with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
laravel/framework Version ^8.37|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package adobrovolsky97/laravel-repository-service-pattern contains the following files

Loading the files please wait ....