Download the PHP package activecollab/resistance without Composer
On this page you can find all versions of the php package activecollab/resistance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package resistance
Resistance
Resistance is a simple Redis key manager for PHP. It does not try to be a fully featured ORM, just to make keyspace management easier.
How to use?
Include it in your project using Composer:
Implement a storage:
Field Settings
Common field settings:
map
- Map ID-s and values and make them accessible viagetIdsBy()
method,protect
- Protect field from being set oninsert()
,required
- Value is required not to be empty,unique
- Make sure that field value is unique in the storage (required is implied). This setting is not applicable to boolean fields,
String field settings:
format
- Value is required and needs to match the given format,isEmail
- Value is required and needs to be a valid email address,isUrl
- Value is required and needs to be a valid URL,modifier
- Make sure that values go through this callback or function before they are stored.
Read, Update, Delete
Instantiate it using a \ActiveCollab\Resistance::factory()
:
Migrations
Resistance implements a simple data migration system. to use migrations, create directory in your project where you will store migrations and name them like Migration0001.ThisIsMigrationDescription.php
or Migration0001.php
. Class names of migrations should be in Migration0001
format and they need to extend ActiveCollab\Resistance\Storage\Migration
class. Description bit is optional and ignored - it's just for your reference. Example:
/my/awesome/project/migrations/Migration0001.AddedNewField.php
/my/awesome/project/migrations/Migration0002.MappedFieldValue.php
/my/awesome/project/migrations/Migration0003.MadeFieldUnqiue.php
/my/awesome/project/migrations/Migration0004.NoLongerNeedsToBeUnique.php
You can instruct Resistance to execute all migrations using:
First parameter is path to the folder where you have your migration classes stored, and second parameter is your migrations namespace. If you are not namespacing your migrations (not recommended), ommit the second parameter blank.
Useful methods that you can use in migrations:
\ActiveCollab\Resistance\Storage\Collection::bulkSetFieldValue($field_name, $value)
- Bulk set field value.$value
can be callback that is called for each record, or a value that will be cast and stored,\ActiveCollab\Resistance\Storage\Collection::bulkRemoveFieldValue($field_name)
- Clean up values from the database, usually after field has been dropped from the collection,\ActiveCollab\Resistance\Storage\Collection::buildValueMap($field_name)
- Create value map for the field, usually after field has been added to the collection,\ActiveCollab\Resistance\Storage\Collection::removeValueMap($field_name)
- Remove value map from the field, after field was removed or mapping is no longer needed,\ActiveCollab\Resistance\Storage\Collection::buildUniquenessMap($field_name)
- Create uniqueness map for the field, usually after field has been added to the collection,\ActiveCollab\Resistance\Storage\Collection::removeUniquenessMap($field_name)
- Remove uniqueness map from the field, after field was removed or it no longer needs to be marked as unique.
How to contribute?
Five simple steps to contribute.
- Fork the repo,
- Clone to your computer,
cd
to checkout folder and runcomposer install
to update dependencies,- Make and push the changes. Make sure that you have tests in place,
- Send a Pull Request.
Thank you!
All versions of resistance with dependencies
ext-json Version *
ext-filter Version *
ext-mbstring Version *
ext-redis Version *
doctrine/inflector Version ~1.0