Download the PHP package nejcc/laravel-querylayer without Composer

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

Laravel QueryLayer

Latest Version on Packagist Total Downloads GitHub Actions

A powerful and flexible repository pattern implementation for Laravel applications. This package provides a clean and maintainable way to handle database operations in your Laravel projects, with built-in singleton pattern support for efficient repository management.

Features

Requirements

Installation

You can install the package via composer:

The package will automatically register its service provider.

Quick Start

Using the Facade

The simplest way to create a repository for any model:

Creating Custom Repositories

For more complex scenarios, extend the BaseRepository:

Available Methods

The repository provides a comprehensive set of methods for database operations:

Method Description
all() Get all records (use with caution for large datasets)
get() Get records for the current query
paginate(?int $perPage = null) Get paginated results
find(int|string $id) Find a record by ID
findBy(string $column, mixed $value) Find a record by column value
where(array $conditions) Add where conditions to the query
create(array $data) Create a new record
update(int|string $id, array $data) Update a record
delete(int|string $id) Delete a record
query() Get the query builder instance
db() Get the raw DB query builder instance
with(string\|array $relations) Eager load relationships
withTrashed() Include soft deleted records
onlyTrashed() Get only soft deleted records
restore(int\|string $id) Restore a soft deleted record
forceDelete(int\|string $id) Permanently delete a record
transaction(callable $callback) Execute operations in a transaction
createOrFail(array $data) Create a record in a transaction
updateOrFail(int\|string $id, array $data) Update a record in a transaction
reset() Reset query scopes and eager loading

Method Chaining

The repository supports fluent method chaining for building complex queries:

Singleton Pattern

The package implements the singleton pattern for repository instances. This means:

Soft Deletes

If your model uses Laravel's SoftDeletes trait, the repository automatically supports:

Transactions

For data integrity, the repository provides transaction support:

Eager Loading

Optimize database queries by eager loading relationships:

Direct Database Access with db()

In addition to the Eloquent query builder accessible via query(), the repository provides raw database access through the db() method:

The db() method provides:

When to use db() vs query():

You can find more examples of using the db() method in the demo repositories:

Testing

The package includes a comprehensive test suite. Run the tests with:

Code Style

This package follows the PSR-12 coding standard. Format your code using Laravel Pint:

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Model Interface

You can also use the repository functionality directly on your models by implementing the ModelInterface and using the HasRepository trait:

Now you can use repository methods directly on your model:

This approach gives you the flexibility to use repository methods either through the repository class or directly on your models.


All versions of laravel-querylayer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^12.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 nejcc/laravel-querylayer contains the following files

Loading the files please wait ...