https://github.com/codelytv/php-criteria
https://github.com/codelytv/php-criteria
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codelytv/php-criteria
- Owner: CodelyTV
- Created: 2024-08-02T12:37:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-10T08:56:13.000Z (over 1 year ago)
- Last Synced: 2025-04-03T00:07:56.471Z (10 months ago)
- Language: PHP
- Size: 114 KB
- Stars: 73
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
🎼 Criteria for PHP
## 📥 Installation
To install the base criteria dependency, run the following command:
```sh
composer require codelytv/criteria
```
Then, install the preferred criteria transformer. You can transform in two directions:
Create a Criteria from:
- [Laravel Request](./packages/criteria-from-laravel-request)
- [Symfony Request](./packages/criteria-from-symfony-request)
- [URL](./packages/criteria-from-url)
Convert a Criteria to:
- [Doctrine](./packages/criteria-to-doctrine)
- [Elasticsearch](./packages/criteria-to-elasticsearch)
- [Eloquent](./packages/criteria-to-eloquent)
Also, you can use Plug&Play transformer for your preferred framework:
- [Laravel](./packages/criteria-from-laravel-request-to-eloquent)
### ✅ Testing
To facilitate the testing of the criteria, you can use the provided [object mothers](https://www.martinfowler.com/bliki/ObjectMother.html):
```sh
composer require codelytv/criteria-test-mother --dev
```
## ➕ Other implementations
We have [another implementation in TypeScript](https://github.com/CodelyTV/typescript-criteria) with converters for Next.js and URL. 🙌
## ⬇️ Adding dependencies to packages
* Don't add the dependency with the command `composer require`, but modify the `composer.json` file directly.
* Don't touch the root `composer.json` file, but the `packages/*/composer.json` one.
* After adding a new dependency, execute `vendor/bin/monorepo-builder merge && composer update` to add automatically the changes to the general `composer.json`.
## 🚀 Release packages
This project is using [monorepo-builder](https://github.com/symplify/monorepo-builder) to manage the monorepo.
To release a new version you should execute:
* `patch` version release: `make release-patch`
* `minor` version release: `make release-minor`
* `major` version release: `make release-major`
This will trigger a GitHub Workflow that would propagate the new version to all the packages in their own GitHub repos.