Download the PHP package sweetcode/cake without Composer

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

Cake - the simple way to validate values

Cake is the latest validation project. Cake is based on "Validatio" and at all Validatio is a nice script, but the main reason to change to Cake is that Cake is 10 times faster than Validation and this is a massive increase in performance.



Installation

Just use Composer

Bugs

  1. When you use aliases with the match rule it's doesn't work in the right way. #00001

How can I use Cake?

It's really simple to use.

1 - First of all create a new instance that you can use to validate your fields

2 - You need a array to validate. The array should follow the following pattern:

3 - Now we validate the given fields.

4 - The Cake#validate() method returns a CakeErrorHandler instance. You can use this instance to echo out the errors.


How can I add my own rules?

  1. Method Name: rule__<your-rule-name> | Replace the <your-rule-name> with your rule name
  2. Method Arguments: rule__<your-rule-name>($field, $value, $arguments) | Your rule method needs three arguments.

2.1) The names of the arguments doesn't matter

  1. The rule method must be "public"
  2. Done! - Now you can use your rule to validate fields.


List of all rules

Name Arguments Example Description
alphanumeric none ['username' => ['Yonas', 'alphanumeric'] Check for alphanumeric character(s).
collection list of values (string) ['service' => ['Google', 'collection(Google, Facebook, Twitter)']] Checks if a value exists in the given collection.
date date format (string) ['birthdate' => ['1.1.1990', 'date(d-m-Y)']] Checks if the value is a valid date - based on the given date format. The method accepts every format that the DateTime#createFromFormat method accepts too.
email none ['emailadress' => ['[email protected]', 'email']] Checks if the value is a valid email address.
hexcolor none ['favouriteColor' => ['#FFFFFF', 'date(d-m-Y)']] Checks if the value is a valid hex color.
match list of fields (string) ['password' => ['test', 'match(repeatPassword)'], 'repeatPassword' => ['test', '']] Checks if the value matches to the other given fields.
ip none ['yourServer' => ['127.0.0.1', 'ip']] Checks if the value is a valid ip address.
maxlength maximum length (integer) ['username' => ['Yonas', 'maxlength(12)']] Checks the maximum length of the value.
minlength minimum length (integer) ['username' => ['Yonas', 'minlength(4)']] Checks the minimum length of the value
required none ['username' => ['Yonas', 'required']] Checks if a value is given.
url none ['homepage' => ['http://example.com', 'url']] Checks if the value is a valid url.
nocaptcha secret (string), sendIp (boolean) ['captcha' => [$_POST['g-recaptcha-response'], 'nocaptcha(mysecrettoke, false)']] Checks if the captcha is answered in the right way

All versions of cake 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 sweetcode/cake contains the following files

Loading the files please wait ....