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

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

Base Repository for Laravel

A lightweight base repository for Laravel Eloquent models with full CRUD and query support. No Criteria pattern, no magic — just a clean wrapper around Eloquent that makes your data access layer consistent, testable, and free of boilerplate.

Installation

Quick Start

1. Create a repository

2. Inject and use

Laravel's container auto-resolves your repository. Just type-hint it:

Available Methods

All methods mirror Eloquent conventions and work identically to their Eloquent counterparts:

Retrieval

Method Description
find($id) Find by primary key, returns model or null
findOrFail($id) Find by primary key, throws ModelNotFoundException
findOr($id, $callback) Find by id or invoke callback
findOrNew($id) Find by id or return new unsaved instance
findMany($ids) Find multiple models by id array
first($columns) First record or null
firstOrFail($columns) First record or throws
firstOr($columns, $callback) First record or invoke callback
firstOrCreate($attributes, $values) Find first match or create
firstOrNew($attributes, $values) Find first match or new instance
all($columns) All records as a Collection
get($columns) Fresh query result as a Collection
paginate($perPage, ...) Paginated results
chunk($count, $callback) Process records in chunks
lazy($chunkSize) Lazy collection for memory-efficient iteration
count($where) Count records, optionally filtered
exists($where) Check if matching records exist
doesntExist($where) Check if no matching records exist
query() Raw Eloquent Builder for custom queries

Mutation

Method Description
create($attributes) Create and persist a model
make($attributes) New unsaved instance
update($id, $attributes) Update by id, returns updated model or null
updateOrCreate($attributes, $values) Update existing or create
delete($id) Delete by id (respects SoftDeletes)
forceDelete($id) Hard delete regardless of SoftDeletes
restore($id) Restore a soft-deleted record

Adding Custom Queries

Use the query() escape hatch to compose any Eloquent query directly:

Testing

Mock the repository in your tests — no database needed:

Or use the repository itself in integration tests. The package ships with its own test suite (Pest, SQLite in-memory) that exercises every method.

Package Tests

Requirements

License

MIT. See LICENSE.


All versions of laravel-base-repository with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/database Version >=13.0
illuminate/pagination Version >=13.0
illuminate/support Version >=13.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 robertgdev/laravel-base-repository contains the following files

Loading the files please wait ...