Download the PHP package mateusjatenee/laravel-persist without Composer

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

Persist

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Introduction

The package offers an extension on top of Eloquent, enabling developers to handle the persistence of entire object graphs as a single unit of work. This package simplifies managing complex data models with multiple interrelated entities, ensuring a more efficient and reliable data handling process.

It works similarly to the native push method, but push does not persist any records for the first time. Therefore, you cannot build an object with its relationships and use push to save everything.

Persist works by hooking on two specific pieces of the lifecycle:

  1. When you assign a property (e.g $post->owner = $user), the package checks whether that property is a relation, and if so, calls setRelation to properly set it.
  2. When you call the persist method, it works in a similar fashion to push, but it adds hooks to persist the related objects before or after the base object. There are subtle differences on persistence order for different relationship types.

On top of that, Persist also runs the entire operation inside a database transaction. This means that if any part of the object graph fails to persist, the entire operation will be rolled back, maintaining database integrity.

Installation

You can install the package via composer:

Usage

Simply add the Persist trait to your models. For example:

Now you'll be able to persist the entire object graph using the persist method. For example:

In the example above, 4 entities will be persisted to the database: Order, OrderLine, Payment, and Customer.
persist runs, by default, within a transaction, so that if any queries fail, the entire transaction is rolled back.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-persist with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^10.0|^11.0
illuminate/database Version ^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 mateusjatenee/laravel-persist contains the following files

Loading the files please wait ....