jooservices / entity
There is no license information available for the latest version (0.5.1) of this package.
0.5.1
2025-06-15 16:46 UTC
Requires
- php: ^8.4
- illuminate/support: *
- nesbot/carbon: 3.*
Requires (Dev)
- fakerphp/faker: ^1.24
- phpunit/phpunit: ^12.1
This package is auto-updated.
Last update: 2025-07-30 02:17:22 UTC
README
This library provides a flexible base for working with entities in PHP applications. It includes abstract base classes and traits for attribute management, casting, and sub-entity handling.
Features
- Abstract base entity class for easy extension
- Attribute management via traits
- Data casting and sub-entity support
- Integration with Laravel's Illuminate components
Installation
- Clone the repository:
git clone <your-repo-url>
- Install dependencies using Composer:
composer install
Usage
Creating an Entity
Extend AbstractBaseEntity
or BaseEntity
to create your own entity:
use JOOservices\Entity\BaseEntity; class UserEntity extends BaseEntity { // Define your custom logic or attributes }
Working with Attributes
Entities support dynamic attribute access and casting:
$user = new UserEntity(['name' => 'John', 'age' => 30]); echo $user->name; // John $user->age = 31;
Converting to Array/JSON
$array = $user->toArray(); $json = $user->toJson();
Testing
Run tests using PHPUnit:
vendor/bin/phpunit
Folder Structure
src/Entity/
- Core entity classes and traitstests/
- Unit testsvendor/
- Composer dependencies
Contributing
Pull requests and issues are welcome. Please follow PSR standards and write tests for new features.
License
MIT