avmg/php-simple-utilities

Various simple Utilities classes like Collections and DTO's with Type safety in mind

1.5.6 2024-11-18 08:22 UTC

README

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.

Features

This package includes the following utilities:

  • 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.

Dependencies

This package has no dependencies. It is designed to be lightweight, self-contained, fast and easy to integrate into any PHP project.

Usage

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.

Installation

To add this library to your project, use Composer:

composer require avmg/php-simple-utilities

Requirements

  • PHP 8.1.0 or higher

Development

To contribute or run tests, you'll need PHPUnit. The library already includes PHPUnit as a dev dependency.

Run tests with:

composer test

License

This project is open-sourced under the MIT License.

Authors

  • AVMG