Download the PHP package baghayi/strategy-validator without Composer

On this page you can find all versions of the php package baghayi/strategy-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package strategy-validator

Strategy Validator

Introduction

This is a zf2 module which is mainly created to be used by Apigility. In fact, apigility ships with a number of validators by default and one of them is Zend\Validator\Callable. StrategyValidator module is very similar to Callable validator in some ways but does things slightly differently.

In Callable, you will have to create an object in advance, which you may never use it. You may even have difficulty passing your domain logic's dependencies to it as well since it is not a Class and even if it is you would have to create an instance of it beforehand.

What I had in mind when creating this module was to solve these issues. Which was bugging me :)

By using this Validator you will only need to create your own class, resolve its dependencies in a very clean and less vague way then pass it to the StrategyValidator validator and you're good to go.

Installation

First you need to download this module to either manually, using git or by composer. It is recommended to use composer, but the choice is yours.

If your are using composer, it will download the module to vendor/ directory by default. If you are downloading manually, or cloning it using git, then you need to place it under vendor/ directory as composer does.

Then you need to add 'StrategyValidator' to your config/application.config.php file under 'modules' key.

Now you are ready to go.

Usage

This validator has already been defined to be used in Apigility and doesn't require you to do anything other than downloading this module and enablding it.

In order to use it, first you will need to create a class which is implementing the following interface:

StrategyValidator/Strategy/StrategyInterface.php

This interface has only one method that needs to be implemented:

isValid($value)

It will get value that needs to be validated as its first argument. After been checked of whether or not it is valid you will need to return a Boolean value.

Then you need to register your class as a service in the main service manager.

It could be a factory, invokable or whatever else you want it to be. It only needs to be registered in the main service manager and not in the validator plugin manager or any other managers.

At last you need to pass the service name to the StrategyValidator validator as strategy.

StrategyValidator validstor (StrategyValidator\Validator\Strategy) has 2 main options. First one like others is message for specifiying a message to be shown whenever validation fails. The second one is strategy which is for specifying your strategy class. (The class you've aleady created in first step)

After registeting your class in the service manager, you need to pass it as strategy option to the StrategyValidator validator alongside with the message option.

Adding Strategy and message options in Apigility admin dashboard is pretty straightforward. As it is listed in the select box (in validations section of cource) and could be selected and specified that way.

In a nutshell:

That's pretty much it. Hope it could have any use.


All versions of strategy-validator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.23
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package baghayi/strategy-validator contains the following files

Loading the files please wait ....