Skip to content

shirokovnv/model-reflection

Repository files navigation

ModelReflection

ci.yml Latest Version on Packagist Total Downloads

The package allows you to reflect properties and methods of the model and save received information in form of a JSON schema.

Installation

Via Composer

$ composer require shirokovnv/model-reflection

Usage

This package is based on Doctrine/DBAL

Once installed you can do stuff like this:

$user_schema = ModelReflection::reflect(\App\Models\User::class);

this will return ReflectedModel containing information about:

  • class name
  • table name
  • fields
  • relations
  • table foreign keys
  • scopes

or you can do:

$user_schema->toArray();

this will return an associative array for JSON representation.

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email shirokovnv@gmail.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.