Download the PHP package stahiralijan/request-caster without Composer

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

Laravel RequestCaster

Latest Stable Version Total Downloads License Monthly Downloads Daily Downloads

Requirements: I've only tested this package with Laravel 5.5, please help me by testing this package in older versions of Laravel

Installation

Install this package by typing the following command:

Usage

Let's learn from an example:

You want to be able to save the submitted data but you don't want to make a mess in the controller method like this:

As you can see after a while you start to wondering what if there is a way you could automate this process so that your controller would look elegant and clean. With this package you can just do that:

Step 1:

Use the RequestCaster Trait in your form request (in this case UserFormRequest):

Step 2:

Define the Request attributes that are required to be casted:

Finally

...and that's all you needed to do, first_name and last_name are automatically capitalized. Also, you don't need to worry about your form data being getting dirty before validation because these castings will run after the validator validates the form data.

Available transformations / Casts

The following casts are available:

Available methods

You can use this method to get a collection (Illuminate\Support\Collection) of all the attributes

How to cast

All of the properties are pretty straight forward, you define the attributes that needs to be casted like this:

You got the idea about the usage of the simple stuff, now one special transformation / caster

If first_name is Tahir and last_name is Jan the output will be Tahir Jan according to the above rule, and can be accessed with $request->fullname or $request->get('fullname')


All versions of request-caster with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
illuminate/support Version ~5.1
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 stahiralijan/request-caster contains the following files

Loading the files please wait ....