Download the PHP package elegantmedia/laravel-simple-repository without Composer

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

Laravel Simple Repository

Latest Version on Packagist

Simple repository pattern for Laravel's Eloquent models.

Why Repositories?

You can still use Eloquent queries to fetch models directly. Purpose of Repositories are to offer a standard API (or an interface), so you have a reliable layer between ORM and the controllers. This will reduce duplication and keep code clean on large applications.

Here's an example where why you may need this.

Finding an Eloquent Model by id. Here you limit column names retrived from database.

You can also do it with a repository, but to fetch relationships (which is a lot more common in large applications).

Then on the repository, you can add some common checks such as checking authorisation, filtering data based on what you retrieve etc.

Install

Install via Composer

Usage

Repository Generator

Create a new repository with make:repository command. By default, they'll be stored in Models directory.

The following options are also available.

By default, the the related model will be guessed. For example, if you're creating CarsRepository we can assume the associated model will be Car in the same directory. But if you want to change it, you can pass that as an argument.

To keep folders clean, you can group the Model+Repository to a single folder.

When you do this, a new plural directory will be automatically created. For example, Cars in this example. The file structure can look like this.

Search

Model

To add basic SQL LIKE search to a model, add the SearchableLike trait to a model.

Now you can do SQL based keyword searches on Models directly.

Repository

You can call search on a repository to build advanced reusable filters.

First, setup the repository

Then call search on your repository. Usually this happens from a controller or a parent repository.

Because the SearchFilter is a query itself, you can use it to chain conditions.

The default filter will add q from query string, and sort results in descending order. If you don't want that, create a filter without the defaults.

Change log

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

Contributing

Please see CONTRIBUTING and for details.

Credits

License

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


All versions of laravel-simple-repository with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/console Version ^10.0
illuminate/database Version ^10.0
illuminate/support 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 elegantmedia/laravel-simple-repository contains the following files

Loading the files please wait ....