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

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

Latest Version on Packagist
Total Downloads

A generic base repository class for Laravel projects that provides a clean and consistent way to interact with Eloquent models. It simplifies CRUD operations and makes your code more maintainable, testable, and scalable.


๐Ÿงฉ Overview

This package provides an abstract EloquentRepository class that implements the EloquentRepositoryInterface. It wraps common model interactions into reusable methods, making it easier to manage data access logic in your Laravel applications.


๐Ÿ›  Installation

Install the package via Composer:


โœ… Usage

1. Create Your Repository Class

Create a new repository class that extends EloquentRepository and specifies the model class:

Note: If you use Laravel Scout with the Searchable trait on your model, the repository will automatically keep the search index in sync.

2. Use the Repository in a Controller or Service

Inject the repository and use its methods:


๐Ÿ”ง Available Methods

Method Description
all() Get all records
count() Count all records
create(array $data) Create a new record
update(int $id, array $data) Update a record by ID
exists(int $id) Check if a record exists
find(int $id) Find a record by ID (returns null if not found)
delete(int $id) Delete a record by ID
query() Return a query builder instance for custom queries
insert(array $data) Insert multiple records (no events, no scout)
upsert(array $values, array\| string $uniqueBy, ?array $update) Update or insert multiple records

๐Ÿ” Laravel Scout Support

The repository automatically handles Laravel Scout indexing when using the Searchable trait:


๐ŸŒ Project Structure


๐Ÿ“ฆ Requirements


๐Ÿงช Testing

You can easily mock the repository interface in your tests, which helps keep your application logic decoupled from the database and improves test coverage.


๐Ÿš€ Contributing

Please see contributing.md for details and a todolist.


๐Ÿ“ License

This package is open-sourced software licensed under the MIT license. Please see the license file for more information.


All versions of laravel-base-repository with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ~5|~6|~7|~8|~9|~10|~11|~12|~13
doctrine/dbal Version *
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 imjonos/laravel-base-repository contains the following files

Loading the files please wait ...