Download the PHP package dannyweeks/laravel-base-repository without Composer

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

Laravel Base Repository

Build Status

An abstract repository class for your Eloquent repositories that requires minimal config to get started.

Features

Quick Start

Install via Composer.

composer require dannyweeks/laravel-base-repository

Extend your repositories with Weeks\Laravel\Repositories\BaseEloquentRepository.

Add the $model property to your repository so the base repository knows what model to use.

That's it! Let's test it out.

Usage

Your repositories must extend the BaseEloquentRepository class and have the properties:

Be sure to check out the example.

Available Methods

See the repository interface class for the full API.

Relationships

Relationships are defined in the repository but are not eagerly loaded automatically.

Relationships can be loaded in the following three ways using the with() method:

An Example

This example shows how your model, repository and controller could be set up.

app\Models\Post.php

app\Repositories\PostRepository.php

app\Http\Controllers\PostController.php

HTTP Exceptions

To enable http exceptions (like Eloquent's findOrFail method) on a repository just have it use \Weeks\Laravel\Repositories\Traits\ThrowsHttpExceptions;.

If the below methods return null they will throw a 404 error instead of returning null.

An example using the ThrowsHttpExceptions trait.

You can temporarily disable HTTP exceptions by chaining disableHttpExceptions() before performing a query. For example:

Caching

To enable caching on a repository just have it use \Weeks\Laravel\Repositories\Traits\CacheResults;.

By doing this all the repository 'read' methods cache their results using Laravel's caching system.

An example using the CacheResults trait.

You can force the result of a request not to be cached by adding the method name to the $nonCacheableMethods property of your repository. See example above.

By default the ttl of a cache item is 60 minutes. This can be overwritten by updating the $cacheTtl property of your repository. See example above.

Caching can be disabled programatically by calling disabledCaching() on your repository. This method returns the repository to enable method chaining e.g. $repo->disableCaching()->getAll();.


All versions of laravel-base-repository with dependencies

PHP Build Version
Package Version
Requires illuminate/database Version >4.0
illuminate/pagination Version 5.2.*
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 dannyweeks/laravel-base-repository contains the following files

Loading the files please wait ....