Download the PHP package andersonef/repositories-pattern without Composer

On this page you can find all versions of the php package andersonef/repositories-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 repositories-pattern

Repositories Pattern on Laravel 5.1 or superior

This package allows you to implement the Repositories design pattern in your laravel application. It makes easy to use a service layer too.

Instalation

Its simply to install, just run:

composer require andersonef/repositories-pattern

Service Provider

You must register this package service provider at you config/app.php file. Just add this line at your $providers array:

Creating your Repositories and Services:

At your console, enter the following command:

php artisan make:repository BlogNamespace/Post --entity=App/Models/Post

Remember to use the complete namespace to your entity path. If your are using a custom namespace, use:

php artisan make:repository BlogNamespace/Post --entity=CustomNamespace/Models/Post

This will create the following file structure in your app directory:

app/

Repositories/

    BlogNamespace/

        PostRepository.php

Services/

    BlogNamespace/

        PostService.php

Repository file structure

Your repository file will be created with the following code:

Service file structure

And your PostService.php file wil be created with the following code:

Usage

Using this pattern you wil be able to separate your application rules from your data access rules and you will be able to reuse your code in a very simple way. Imagine that you have an app that users can register using the public pages AND the admin register users using the admin panel. The rules to register an user are the same on both cases, but the admin panel must require an admin logged user AND has an option to isent the new user to pay his subscription value. In the old way you would have to replicate the code or use a laravel command to isolate the user registration rules. Using the service layer and the repository pattern you will write the user registration rules inside the UserService and on both controllers (public page registration and admin panel) you would call the $userService->create($request->all()). If you must implement an api to save users from an android interface, you can reuse your service layer and just change the way your controller respond to the client.

Repository Inherited Methods:

Your repository have some inherited methods from RepositoryAbstract class. They are:

Credits

This package has been created based on this other: https://github.com/prettus/l5-repository I just implement a few more options and make some fews changes to turn it better for the company I work.


All versions of repositories-pattern with dependencies

PHP Build Version
Package Version
No informations.
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 andersonef/repositories-pattern contains the following files

Loading the files please wait ....