Download the PHP package danack/datatype without Composer
On this page you can find all versions of the php package danack/datatype. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danack/datatype
More information about danack/datatype
Files in danack/datatype
Package datatype
Short Description A library that makes using data types easier
License MIT
Informations about the package datatype
DataType
A library for validating input and creating types.
Installation
Example usage
The full documentation is in DOCS.md, but here is an example usage.
In your controller, you would have some code to create the type. e.g. for Symfony you would have something like:
In your code you would have a data type that represents a particular concept, e.g. the search parameter used in the API:
And each of the elements in the 'search parameters' would have their own rule based based details:
OpenAPI descriptions
The OpenAPI/Swagger specification for individual DataTypes can be generated directly from each DataType. e.g. This code:
Would generate:
which would be consumed by the front-end, either dynamically or statically through being converted to code.
To note, the OpenAPI generation is one of the less tested part of the code.
Contributing
There are a few areas where contributions will be warmly welcomed:
-
Error messages. Writing clear error messages is always hard. There are almost certainly some areas where the message could be clearer, or just more consistent with other messages. All the messages are in src/DataType/Messages.php
-
Documentation. Contributions to documentation are always welcome.
- More extraction and processing rules. Although the library currently fits my needs well, it is likely there are common rules that are not currently included.
Contributing code
We have several tools that are run to improve code quality. Please run sh runTests.sh
to run them.
Pull requests should have full unit test coverage. Preferably also full mutation coverage through infection.
All versions of datatype with dependencies
ext-mbstring Version *
danack/var-map Version ^0.6.1
seld/jsonlint Version ^1.9.0