Config
, (*1)
This is the core of all Amethyst packages., (*2)
Requirements
Installation
You can install it via Composer by typing the following command:, (*3)
composer require amethyst/core
The package will automatically register itself., (*4)
Mapping the hell out of it
Amethyst takes a lot of advantages by mapping all models, relations and attributes; it does soo much that it's a requirement for every package:, (*5)
- Each instance of Model must be converted in a readable string (e.g. classname, or morph name) and viceversa.
- Given an instance of Model it should be possible to retrieve all relations.
- Given an instance of Model it should be possibile to retrieve all attributes.
Note: It's important to notice that we are refering to an instance of Model instead of class of Model., (*6)
What are the benefits then?
Because having this kind of information will make a lot of things easy (for e.g. auto joins, creating views), (*7)
How it's done and how extend it
All amethyst packages are automatically mapped, that's because the mapping use the configuration under amethyst
to retrieve all models, (*8)
This is done by using the package eloquent-mapper., (*9)
How interact with the data
There are two ways to interact with the data: Through code or with http calls, (*10)
Code
Http calls
Each data has the following operation:
- 'Create a new record'
- 'Retrieve a single record'
- 'Update a single ecord'
- 'Delete a single record'
- 'Show multiple records'
- 'Remove multiple records'
- 'Update multiple records', (*11)
How customize the data
One of the key package used to handle data is lem. This package provide a way to define a schema, validate, authorize, serialize and handle errors; all of this incapsulated by a class, called the Manager
., (*12)
https://github.com/amethyst-php/cli, (*13)
Testing
- Clone this repository
- Copy the default
phpunit.xml.dist
to phpunit.xml
- Change the environment variables as you see fit
- Launch
./vendor/bin/phpunit