endroid / property-access
Endroid Property Access
Fund package maintenance!
endroid
Installs: 138 435
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- symfony/expression-language: ^5.4||^6.4||^7.0
- symfony/property-access: ^6.4||^7.0
Requires (Dev)
- endroid/quality: dev-main
Suggests
- roave/security-advisories: Avoids installation of package versions with vulnerabilities
README
By endroid
Extends the Symfony property accessor with the ability to filter on objects using the expression language component. An example of such a query would be band.member[address.street=="Abbey Road"].firstName. This functionality makes it easier to retrieve properties without the need for looping through values.
Great advantage of this approach is the possibility of specifying conditional mapping via configuration instead of code.
Installation
Use Composer to install the library.
$ composer require endroid/property-access
Usage
<?php use Endroid\PropertyAccess\PropertyAccessor; $accessor = new PropertyAccessor(); // Returns the first name of the first band member that lives on Abbey Road $firstName = $accessor->getValue($band, 'member[address.street=Abbey Road][0].firstName');
Versioning
Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.
License
This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.