-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3495be1
commit dd8d424
Showing
17 changed files
with
4,057 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 4 | ||
|
||
[docker-compose.yml] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [ 8.3 ] | ||
|
||
name: PHP ${{ matrix.php }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom | ||
coverage: pcov | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --prefer-dist --no-interaction --no-progress | ||
|
||
- name: Run Tests & Generate Code Coverage Report | ||
run: vendor/bin/phpunit --coverage-clover 'coverage.xml' | ||
|
||
- name: Publish Code Coverage | ||
uses: paambaati/codeclimate-action@v3.2.0 | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
with: | ||
coverageLocations: | | ||
${{ github.workspace }}/coverage.xml:clover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/vendor | ||
/.idea | ||
/reports | ||
/phpunit.xml | ||
.phpunit.result.cache | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
php: | ||
preset: laravel | ||
|
||
enabled: | ||
- align_double_arrow | ||
- align_equals | ||
- assign_null_coalescing_to_coalesce_equal | ||
- boolean_operator_linebreak_beginning | ||
- combine_consecutive_issets | ||
- combine_consecutive_unsets | ||
- concat_with_spaces | ||
- const_visibility_required | ||
- empty_loop_body_semicolon | ||
- empty_loop_condition | ||
- explicit_indirect_variable | ||
- explicit_string_variable | ||
- linebreak_after_opening_tag | ||
- method_chaining_indentation | ||
- multiline_comment_opening_closing | ||
- no_blank_lines_between_traits | ||
- nullable_type_declarations | ||
- ordered_class_elements | ||
- php_unit_fqcn_annotation | ||
- php_unit_internal_class | ||
- php_unit_test_case_self_method_calls | ||
- php_unit_test_class_requires_covers | ||
- phpdoc_add_missing_param_annotation | ||
- phpdoc_inline_inheritdoc | ||
- phpdoc_link_to_see | ||
- phpdoc_trim_consecutive_blank_line_separation | ||
- phpdoc_var_order | ||
- property_separation | ||
- protected_to_private | ||
- semicolon_after_instruction | ||
- simplified_if_return | ||
- single_space_after_construct | ||
- standardize_increment | ||
|
||
disabled: | ||
- unalign_equals | ||
- concat_without_spaces | ||
- not_operator_with_successor_space | ||
- trailing_comma_in_multiline_array | ||
- phpdoc_summary | ||
- laravel_braces | ||
|
||
js: false | ||
css: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Laravel Repositories | ||
|
||
Copyright Sine Macula Limited. or its affiliates. All Rights Reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"). | ||
You may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,59 @@ | ||
# laravel-repositories | ||
Provides data repository patterns with criteria-based query filtering for eloquent model manipulation in Laravel. | ||
# Laravel Repositories | ||
|
||
[![Build Status](https://github.com/sinemacula/laravel-repositories/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-repositories/actions/workflows/tests.yml) | ||
[![StyleCI](https://github.styleci.io/repos/787662248/shield?style=flat&branch=master)](https://github.styleci.io/repos/787662248) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/d7efec236c6db6d92f2d/maintainability)](https://codeclimate.com/github/sinemacula/laravel-repositories/maintainability) | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/d7efec236c6db6d92f2d/test_coverage)](https://codeclimate.com/github/sinemacula/laravel-repositories/test_coverage) | ||
|
||
This Laravel package offers a streamlined repository pattern implementation with criteria-based query filtering, | ||
optimized for elegant and efficient manipulation of Eloquent models. It simplifies the robust capabilities of the | ||
original l5-repositories, focusing on the features most essential and frequently used, given that the l5-repositories | ||
project is no longer maintained. | ||
|
||
A big thanks to the creators of [andersao/l5-repository](https://github.com/andersao/l5-repository) for their pioneering | ||
work, which heavily inspired this project. Our package aims to continue in that spirit, tailored for today's Laravel | ||
applications. | ||
|
||
## Features | ||
|
||
- **Clean Model Architecture**: Implements the data repository pattern to abstract data logic away from the models, | ||
ensuring that your models stay clean and focused solely on their intended functionalities. | ||
- **Flexible Data Retrieval**: Utilizes a robust system of criteria and scopes that allow for precise and flexible | ||
retrieval of data, enabling developers to easily implement complex query logic without cluttering the model layer. | ||
- **Criteria-Based Filtering**: Offers the ability to dynamically add, remove, or modify query criteria on-the-fly, | ||
providing powerful and reusable components for custom query construction. | ||
|
||
## Installation | ||
|
||
To install the Laravel API Repositories package, run the following command in your project directory: | ||
|
||
```bash | ||
composer require sinemacula/laravel-repositories | ||
``` | ||
|
||
## Configuration | ||
|
||
After installation, publish the package configuration to customize it according to your needs: | ||
|
||
```bash | ||
php artisan vendor:publish --provider="SineMacula\RepositoryServiceProvider" | ||
``` | ||
|
||
This command publishes the package configuration file to your application's config directory. | ||
|
||
## Usage | ||
|
||
Coming soon... | ||
|
||
## Contributing | ||
|
||
Contributions are welcome and will be fully credited. We accept contributions via pull requests on GitHub. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email instead of using the issue tracker. | ||
|
||
## License | ||
|
||
The Laravel Repositories repository is open-sourced software licensed under | ||
the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "sinemacula/laravel-repositories", | ||
"type": "library", | ||
"description": "Provides the repository data pattern to Laravel applications", | ||
"keywords": [ | ||
"sine macula", | ||
"laravel", | ||
"repositories" | ||
], | ||
"license": "Apache-2.0", | ||
"authors": [ | ||
{ | ||
"name": "Ben Carey", | ||
"email": "bdmc@sinemacula.co.uk" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.3", | ||
"illuminate/database": "^11.3", | ||
"illuminate/support": "^11.3" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^11.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"SineMacula\\Repositories\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
Oops, something went wrong.