Download the PHP package ibrostudio/laravel-data-repository without Composer

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

Laravel Data Objects Repository

Save Data Transfer Objects (from Spatie's Laravel Data) and Value Objects (from Michael Rubel's Laravel Value Objects) in database and attach to eloquent models.

Installation

Install the package via composer:

Then run the installer:

Usage

Add the trait IBroStudio\DataRepository\Concerns\HasDataRepository to your Eloquent models.

The trait implements a MorphManyDataObjects relationship that extends MorphMany.

Working with DTO

Create your DTO following Spatie's Laravel Data documentation.

Working with Value Objects

Use built-in Value Objects or create one following Michael Rubel's Value Objects documentation.

Save the Value Object attached to the model in database:

For more complex usage, you can use Value Objects in DTO:

Creating or updating objects

The following method save the object in database and attach it to the model:

If an object with the sans data class is already attached to the model, its values will be replaced.

Unique data class

You can attach many objects to a model but only one for each data class by default. Considering the previous examples, the model can have only one SongData object (and other DTO or Value Objects).

Multiple data class

If you need more than one object from the same data class, use the valuesAttributes parameter when you create or update an object:

Retrieving objects

You access to all MorphManyDataObjects relations for a model with:

You can limit the instance to a specific data class to access a single object:

The object is then retrieved by the values() method:

If necessary, you can also constrain the retrieval of the object to certain values of this object with the valuesQuery parameter:

Eloquent attribute casting

You can get direct access to an object value like $model->song instead of $model->data_repository(dataClass: SongData::class).

Add a unsignedBigInteger column to your model:

And then add the cast to the model class:

Usage:

Built-in Objects Values

Testing

Changelog

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

License

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


All versions of laravel-data-repository with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
darsyn/ip Version ^5.0
gabrielelana/byte-units Version ^0.5.0
illuminate/contracts Version ^11.0
michael-rubel/laravel-value-objects Version ^7.0
spatie/laravel-data Version ^4.0
spatie/laravel-package-tools Version ^1.14.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 ibrostudio/laravel-data-repository contains the following files

Loading the files please wait ....