Download the PHP package rnr1721/le7-db-redbean without Composer
On this page you can find all versions of the php package rnr1721/le7-db-redbean. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package le7-db-redbean
le7-db-redbean
Allow easy use pagination, validation and normalisation in any PHP project that use Redbean PHP
Requirements
- PHP 8.1 or higher.
- Composer 2.0 or higher
Dependencies
All dependencies installs automatic by composer
- RedbeanPHP (https://github.com/gabordemooij/redbean)
- Entify Entity Framework (https://github.com/rnr1721/le7-entify)
What it can?
- Easy-to-use models classes in some namespace
- Pagination using Entify entity framework
- Validation using rules (using Entify entity framework)
- use arrow RedbeanPHP method calls instead static methods
- Contain very simple lightweight SQL query builder
Installation
Testing
How it works?
After installing, you need decide where will be your models. For example in \Model. Any model is class, that contain entity rules. IMPORTANT: validation rules must contain information about all entity fields. Required fields is "label" and "validate". Any other fields is optional. All models must be extends of Model and implements ModelInterface same as in this example below:
Example of model (in namespace Model):
You can read more about entity field rules options on Entify project page https://github.com/rnr1721/le7-entify (validation etc). Here it should be said that the specific field option for this package, unlike other fields, is "unique", that must be true or false. Also, when saving entities the "hide" filter will be skipped.
This software is convenient to use along with a dependency container. In the container, you can pre-configure everything, and then conveniently and easily use it in your code using dependency injection (DI).
So, now we can use this model.
Basic usage
If you need multi-lingual validator messages, please send me translations for this projects (or make commit requests) and I add them: https://github.com/rnr1721/le7-validator
Multiple entities
Now we can try to work with arrays of entities. For example, we need to paginate SQL request or filter it after recieving.
Of course you can use tokens, something like this:
About this knows all, but for same, I strongly recommend use bindings instead direct values!
Connection
You can easy add databases, and manage connections. Example: