Download the PHP package puncoz/laravel-repository without Composer

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

Laravel Repository Pattern Implementation

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A lightweight and flexible implementation of the Repository Pattern for Laravel applications. This package provides a clean and consistent way to handle data access layers in your Laravel applications.

Features

Installation

You can install the package via composer:

You can publish the config file with:

Basic Usage

  1. Create a repository interface:

  2. Create a repository implementation:

  3. Register the repositories in the service provider:

In Laravel 11 and 12, manually register your service provider in bootstrap/providers.php:

  1. Use the repository in your application:

✅ Ready to rock!

Now, Laravel will automatically resolve the correct repository implementation via the interface wherever it's type-hinted using constructor injection or service container resolution.

⚙️ New Artisan Commands

This package now includes three powerful Artisan commands to help scaffold Repositories, Transformers, and Filters with minimal effort.

🔧 Configuration You can customize the default paths via the repository file located at: config/repository.php

📦 make:repository

Generate Repository and Interface as same time with:

Example

This will generate:

It automatically handles:

🔄 make:transformer

Generate a Transformer class.

Example

✅ This will generate:

🔍 make:filter

Generate a Filter class for Eloquent query filtering.

Example

✅ This will generate:

🧠 💡 Notes

Available Methods

Basic Operations

Filtering and Scopes

Data Transformation

Relations

Creating Custom Filters

  1. Create a filter class:

  2. Apply the filter with queries:

How Filters Work

  1. Query Parameter to Method Mapping:

    • queries/filters array is passed to the constructor
    • Query/filter parameters (keys in the array passed to the constructor) are automatically mapped to filter methods
    • Method names must be in camelCase and end with 'Filter' suffix
    • Examples:
      • search => searchFilter()
      • user_status => userStatusFilter()
      • created_at => createdAtFilter()
  2. Filter Method Signature:

    • First parameter: Eloquent Query builder instance
    • Second parameter: Value from the queries array
    • Must return: Eloquent Query Builder instance
  3. Filter Lifecycle:

    • preHook: Runs before any filter methods
    • Filter methods: Run in the order they are defined
    • postHook: Runs after all filter methods
  4. Optional Methods:
    • All filter methods are optional
    • preHook and postHook are optional
    • Only methods matching query parameters will be called

Data Transformation

The package uses Fractal Transformers for data transformation. Here's how to implement transformers:

  1. Create a transformer class:

  2. Use transformation in your application:

Testing

The test suite uses Pest on top of Orchestra Testbench with an in-memory SQLite database, so no external services are needed.

Static analysis settings live in phpstan.neon.dist. CI runs Pest and PHPStan for every supported PHP and Laravel combination (see .github/workflows/run-tests.yml).

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of laravel-repository with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
league/fractal Version ^0.20.1
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 puncoz/laravel-repository contains the following files

Loading the files please wait ...