Download the PHP package antriver/laravel-repositories without Composer

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

Laravel Repositories

The classes provided here allow you to use a repository pattern for CRUD operations on your Laravel models.

Installation

Basic Usage

Create a class which extends AbstractRepository.

You now have a repository for Post models with the following methods:

find(int $modelId)

Returns a single model by its primary key, or returns null.

findOrFail(int $modelId)

Returns a single model by its primary key, or throws a ModelNotFoundException.

findMany(array $modelIds)

Returns a collection of multiple models. The result will only contain the models that were found.

findOneBy(string $field, $value)

Returns a single model where field matches value, or returns null.

findOneByOrFail(string $field, $value)

Returns a single model where field matches value, or throws a ModelNotFoundException.

persist(Model $model)

Save the given model to the database.

remove(Model $model)

Delete the given model from the database.

incremenet(Model $model, $column, $amount)

Increase the value in the given column by the amount specified.

(i.e. UPDATE table SET column = column + 1);

decrement(Model $model, $column, $amount)

Decrease the value in the given column by the amount specified.

(i.e. UPDATE table SET column = column - 1);

Caching Repository

If you extend AbstractCachedRepository instead of AbstractRepository you will have all the same functions, however the following operations will look in a cache for the model first.

The caching repository also has these additional methods:

forgetById(int $modelId)

Forgets a cached copy of a model (does not delete it from a database).

forgetByModel(Model $model)

Forgets a cached copy of a model (does not delete it from a database).

refreshById(int $modelId)

Updates the cached copy of a model with the latest version found in the database.

Soft Deletable Repository

If your model supports soft deletes (Illuminate\Database\Eloquent\SoftDeletes trait), the find etc. methods above will exclude soft deleted models from the results.

If you extend AbstractSoftDeletableRepository instead of AbstractRepository you will get these additional methods:

findWithTrashed(int $modelId)

findWithTrashedOrFail(int $modelId)

Returns a single model by primary key even if it has been soft-deleted.

findTrashed(int $modelId)

findTrashedOrFail(int $modelId)

Returns a model by primary key only if it has been soft-deleted.

findOneByWithTrashed(string $field $value)

findOneByWithTrashedOrFail(string $field, $value)

Returns a single model where field matches value even if it has been soft-deleted.

findTrashedOneBy(string $field $value)

findTrashedOneByOrFail(string $field, $value)

Returns a single model where field matches value only if it has been soft-deleted.

Caching Soft Deletable Repository

This combines the functionality of AbstractCachedRepository and AbstractSoftDeletableRepository.

When using this, the cache of models will be populated with soft-deleted models too. This applies to the primary key cache and the field/value cache. There is filtering inside the repository to return null/throw as appropriate if a trashed or not-trashed model is requested.


All versions of laravel-repositories with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
laravel/framework Version >=10.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 antriver/laravel-repositories contains the following files

Loading the files please wait ....