Download the PHP package litepie/repository without Composer
On this page you can find all versions of the php package litepie/repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package repository
Litepie Repository - Laravel Repository Pattern with Enterprise Features
A comprehensive Laravel repository package that provides enterprise-level features for data access, performance optimization, analytics, and advanced querying capabilities. Perfect for applications handling large datasets, complex relationships, and requiring high-performance data operations.
✨ Features
Core Repository Pattern
- ✅ Complete CRUD Operations - Standard create, read, update, delete operations
- ✅ Clean Interface Separation - Well-defined contracts and implementations
- ✅ Laravel Best Practices - Follows Laravel conventions and patterns
Advanced Query Building
- � Advanced Join Capabilities - Left, right, inner joins with relationship handling
- 🔍 Comprehensive Filtering - Dynamic field filtering with multiple operators
- 🎯 Query String Parser - Parse complex URL filters with 20+ operators
- 📊 Dynamic Scopes & Macros - Extensible query building with custom scopes
Performance & Optimization
- 🚀 Large Dataset Optimization - Handle 5M+ records efficiently with cursor pagination
- ⚡ Smart Pagination - Auto-optimization for different dataset sizes
- � Performance Metrics - Built-in profiling and query analysis
- 🧠 Intelligent Caching - Advanced caching with tags and auto-invalidation
Data Operations
- � Bulk Operations - Efficient bulk insert, update, delete, and upsert
- 🔄 Batch Processing - Process large datasets in manageable chunks
- 📁 Data Export/Import - CSV, JSON, Excel export/import with streaming
- � Relationship Manager - Advanced relationship handling and optimization
Analytics & Insights
- 📊 Repository Aggregations - Statistical analysis and trend calculations
- 📈 Analytics Functions - Percentiles, correlations, moving averages
- � Pivot Tables - Dynamic data pivoting and cross-tabulation
- 📉 Histogram Generation - Data distribution analysis
Search & Discovery
- 🔍 Multi-Engine Search - Database, Elasticsearch, and Algolia integration
- 🎯 Fuzzy Search - Similarity-based matching with configurable thresholds
- 📝 Full-Text Search - Advanced text search with relevance scoring
- 🔧 Search Index Management - Automated indexing and reindexing
Events & Monitoring
- 🎪 Repository Events - Comprehensive event system for all operations
- � Performance Monitoring - Real-time metrics and benchmarking
- 🚨 Error Tracking - Built-in error handling and reporting
- 📋 Audit Trail - Complete operation logging and tracking
Security & Validation
- 🛡️ Field Whitelisting - Secure field access control
- ✅ Input Validation - Built-in data validation and sanitization
- � Rate Limiting Ready - Prepared for rate limiting implementation
- 🛡️ SQL Injection Protection - Secure query building
A Laravel package that implements the Repository pattern with a clean, intuitive API. This package provides a base repository class, interfaces, service provider bindings, CRUD operations, pagination support, and artisan commands to generate repositories.
Features
- 🏗️ Repository Pattern Implementation - Clean separation of data access logic
- 🔧 Base Repository Class - Common CRUD operations out of the box
- 🎯 Repository Interface - Contract-based development
- 📦 Service Provider - Automatic Laravel integration
- 🔍 Advanced Querying - Search, filtering, and sorting capabilities
- � Comprehensive Join Support - Inner, left, right, cross joins with subqueries
- 📊 Aggregation Methods - Group by, having, raw expressions, and complex analytics
- �📄 Pagination Support - Built-in pagination methods
- ⚡ Artisan Commands - Generate repositories with
make:repository
- 🧪 Fully Tested - Comprehensive test suite
- 📚 Well Documented - Complete documentation and examples
Requirements
- PHP 8.2 or higher
- Laravel 11.0 or 12.0
Installation
You can install the package via Composer:
The package will automatically register its service provider.
Quick Start
1. Create a Repository
Use the artisan command to generate a repository:
This will create a repository class and interface in your app/Repositories
directory.
2. Use the Repository
Usage
Basic CRUD Operations
Advanced Querying
Repository Methods
The base repository provides the following methods:
Basic CRUD
all($columns = ['*'])
- Get all recordsfind($id, $columns = ['*'])
- Find record by IDcreate(array $data)
- Create new recordupdate($id, array $data)
- Update existing recorddelete($id)
- Delete record by ID
Query Building
where($column, $operator = null, $value = null)
- Add where clauseorWhere($column, $operator = null, $value = null)
- Add or where clausewhereIn($column, array $values)
- Add where in clausewhereBetween($column, array $values)
- Add where between clausewhereNull($column)
- Add where null clausewhereNotNull($column)
- Add where not null clausewhereDate($column, $operator, $value)
- Add where date clausewhereRaw($sql, array $bindings = [])
- Add raw where clauseorderBy($column, $direction = 'asc')
- Add order by clauseorderByRaw($sql, array $bindings = [])
- Add raw order by clausewith($relations)
- Eager load relationshipslimit($limit)
- Limit resultsoffset($offset)
- Offset results
Join Operations
join($table, $first, $operator = null, $second = null)
- Add inner joinleftJoin($table, $first, $operator = null, $second = null)
- Add left joinrightJoin($table, $first, $operator = null, $second = null)
- Add right joininnerJoin($table, $first, $operator = null, $second = null)
- Add inner joincrossJoin($table)
- Add cross joinjoinWhere($table, callable $callback)
- Add join with closure conditionsleftJoinWhere($table, callable $callback)
- Add left join with closurejoinSub($query, $as, $first, $operator, $second)
- Add subquery joinleftJoinSub($query, $as, $first, $operator, $second)
- Add left subquery join
Aggregation & Grouping
select($columns)
- Select specific columnsselectRaw($expression, array $bindings = [])
- Add raw select expressiondistinct()
- Add distinct clausegroupBy($groups)
- Add group by clausehaving($column, $operator, $value)
- Add having clauseorHaving($column, $operator, $value)
- Add or having clausehavingBetween($column, array $values)
- Add having between clause
Advanced Queries
findWhere(array $where, $columns = ['*'])
- Find records with conditionsfindWhereIn($column, array $values, $columns = ['*'])
- Find records where column in valuespaginate($perPage = 15, $columns = ['*'])
- Paginate resultssimplePaginate($perPage = 15, $columns = ['*'])
- Simple pagination
Utility Methods
count()
- Count recordsexists($id)
- Check if record existschunk($count, callable $callback)
- Process records in chunks
Custom Repository Example
Service Provider Bindings
The package automatically binds repository interfaces to their implementations. You can also manually bind repositories in your AppServiceProvider
:
🚀 Large Dataset Optimization
When dealing with datasets over 5 million records, traditional pagination becomes slow. This package provides several optimization strategies:
Cursor-Based Pagination (Recommended)
Fast Pagination (No Total Count)
Smart Pagination (Auto-Optimization)
Memory-Efficient Processing
Performance Comparison
Method | 1M Records | 5M Records | 10M Records | Best For |
---|---|---|---|---|
Standard | ~500ms | ~2000ms | ~5000ms+ | Small datasets |
Fast | ~50ms | ~100ms | ~150ms | No total needed |
Cursor | ~10ms | ~15ms | ~20ms | Large datasets |
Seek | ~5ms | ~10ms | ~15ms | Real-time feeds |
📖 Read the complete optimization guide →
🔍 Query String Filter Parser
Parse complex filter expressions from URL query strings for advanced search and filtering capabilities.
Complex Filter Syntax
Supported Operators
- Comparison:
EQ
,NEQ
,GT
,GTE
,LT
,LTE
- Arrays:
IN
,NOT_IN
- Ranges:
BETWEEN
,NOT_BETWEEN
- Strings:
LIKE
,NOT_LIKE
,STARTS_WITH
,ENDS_WITH
- Nulls:
IS_NULL
,IS_NOT_NULL
- Dates:
DATE_EQ
,DATE_GT
,DATE_BETWEEN
,YEAR
,MONTH
- JSON:
JSON_CONTAINS
,JSON_LENGTH
Real-World Example
Frontend Integration
📖 Complete Query String Parser Guide →
Artisan Commands
make:repository
Generate a new repository class and interface:
Configuration
You can publish the configuration file:
This will create a config/repository.php
file where you can customize:
- Default repository namespace
- Default interface namespace
- Repository stub files
Testing
Run the tests with:
🚀 Advanced Features
Your repository package now includes these enterprise-level features:
📊 Analytics & Data Science
🔍 Advanced Search
📦 Bulk Operations
🧠 Intelligent Caching
📈 Performance Monitoring
📁 Data Import/Export
🎪 Event System
🔗 Relationship Management
For detailed documentation on all advanced features, see Advanced Features Guide.
📚 Documentation
- Advanced Features Guide - Complete guide to all enterprise features
- Query String Parser - URL filter parsing documentation
- Performance Optimization - Optimization strategies for large datasets
- API Reference - Complete API documentation
🎯 Real-World Examples
Perfect for applications like:
- E-commerce platforms - Product catalogs, order processing, inventory management
- Real estate systems - Property listings, advanced filtering, market analytics
- CRM systems - Customer data, relationship tracking, performance analytics
- Content management - Article publishing, media handling, user engagement tracking
- Financial applications - Transaction processing, reporting, audit trails
- IoT platforms - Sensor data, time-series analysis, bulk data processing
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Litepie Team
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
All versions of repository with dependencies
illuminate/contracts Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/pagination Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/console Version ^11.0|^12.0