Download the PHP package marco-fiset/flute without Composer

On this page you can find all versions of the php package marco-fiset/flute. 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 flute

Flute

An utterly awesome and easy-to-use, lightweight and highly-extensible fluent validation framework for PHP.

Flute's fluent interface is heavily inspired by FluentValidation for .NET.

Here is a simple example to get you started :

These validation rules are supported out of the box :

Creating custom validation rules

It's very easy to create custom rules, and you don't even have to alter the Validator class. Everything is done with magic naming conventions! For example, here is how the NotEmpty rule is built :

Once your rule is defined, it must be discoverable by any registered auto-loader in order the make it available to the Validator class. Here is how you invoke it :

See what I did there? No need to add the not_empty() function to the validator. Any unknown function invoked on a validator will create a rule named with the following conventions :

So not_empty becomes NotEmptyRule. The validator will instantiate a NotEmptyRule class and associate it with the property name defined when we called rule_for. Easy, huh?

What if I want to use parameters?

Very simple. Here is a brief look at the MaxLengthRule implementation.

Any parameters passed to the function definition will be registered in the args array in the same order that they were passed to the validator rule. You can also access args with the magic __get method, like I did here with max_length. I you were to call max_length again, it will send back the same value as the first time it was called. When using multiple arguments, they are handed out in the order they were passed, and each name gets its own argument.

Extending existing rules

Your custom rule can extend the behaviour of existing rules. Let's take a look at the RequiredRule implementation :

As you can see, the RequiredRule is only a combination of the NotNullRule and the NotEmptyRule. The extend function returns an array of instantiated rules which you want to extend. The condition function will be called on both rules and combined with a logical and. That is, if any of the condition fails, it is considered invalid.

That's it for the moment! Stay tuned for more awesome features!


All versions of flute with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 marco-fiset/flute contains the following files

Loading the files please wait ....