This package, avmg/php-simple-utilities
, provides a set of simple utility classes including Collections and DTOs (Data Transfer Objects) with a focus on type safety. Designed with simplicity in mind, these utilities are perfect for integrating standard data manipulation and collection handling capabilities into your PHP projects.
This package includes the following utilities:
- Arr Class: A set of powerful utility methods for working with arrays in PHP, offering a clean and expressive API for common array operations, inspired by Laravel's collection methods.
- Collection Class: Offers a fluent interface for array manipulation, providing methods for filtering, mapping, reducing, and more, all while maintaining type safety.
- Data Class: An abstract class aimed at creating type-safe DTOs, ensuring data integrity throughout your application.
- FileCache Class: A simple interface for storing, retrieving, and managing cache data in the filesystem.
- EventDispatcher Class: A simple, yet powerful way to manage and dispatch events throughout your PHP application.
- Plastic Class: A Simple Carbon inspired class for working with dates and times, with no dependencies and a focus on simplicity and type safety.
- FileStorage Class: A simple and efficient way to handle file storage operations within a filesystem, providing functionalities such as creating directories, storing, retrieving, and deleting files.
- Validator Class: A simple and flexible way to validate data against a set of rules, with support for custom validation methods and error messages.
This package has no dependencies. It is designed to be lightweight, self-contained, fast and easy to integrate into any PHP project.
All classes are single file based and self-contained, so you can easily copy them into your project if you prefer not to require another Composer package.
This package is aimed at developers looking for simple, type-safe utilities to enhance their PHP applications and workflows.
To add this library to your project, use Composer:
composer require avmg/php-simple-utilities
- PHP 8.1.0 or higher
To contribute or run tests, you'll need PHPUnit. The library already includes PHPUnit as a dev dependency.
Run tests with:
composer test
This project is open-sourced under the MIT License.
- AVMG