Download the PHP package georgehanson/laravel-persisters without Composer

On this page you can find all versions of the php package georgehanson/laravel-persisters. 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-persisters

Laravel Persisters

Build Status Coverage

This package is designed to make it easy to create a persister class for your laravel project. The idea of persisters is to abstract the data storing process.

Installation

To install the package, simply add the following to your composer.json file:

Usage

Creating Persisters

To create a persister you simply need to create a new class, have it extend the base persister class and implement the abstracted methods. Here is an example:

In order to use your new persister, you can simply instantiate the class and call the persist method. Below is an example:

The base persister class will automatically work out whether you are creating a record or updating a record.

Creating Records

To create a new record using your persister class, simply call the persist method and pass in the data you which to save. The persist method can either accept an array of data, or a class which is Arrayable (such as a Collection, Request). Here is an example of creating a resource from a request.

This will the fire the create method within your persister class you have created. Here you can handle any logic you wish for creating the resource.

Updating Records

Updating records is just as simple as creating records. The only difference is you have to pass a second parameter to the persist method which is the model you want to update. Below is an example of how you would update a record from a request.

Filtering Data

We cannot be certain that the data we receive in our request is always the data we want to persist. For example, when we are saving the record we do not want to store the _token which is passed by Laravel for CSRF protection. We can do this simply by specifying the keys in the persister. This will then filter the data which has been passed and only return the data where that key exists. If you have specified a key in the keys array, however it is not found in the data being passed to the persister then it will set the value of that key to null. Here is an example of filtering the data:

Alternatively, if you don't specify any keys it will return all of the data as an array.


All versions of laravel-persisters with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^5.7|^5.6|^5.5|^5.4
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 georgehanson/laravel-persisters contains the following files

Loading the files please wait ....