Download the PHP package ylsideas/forecaster without Composer

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

Forecaster :partly_sunny: Build Status

Forecaster is a library for manipulating and casting associative arrays in PHP.

While the project makes use of a class and helpers found in Laravel it can be used in non-Laravel projects as it only depends upon the Tighten Co's Collect package and not the Laravel Support package meaning it's compatible with any framework or stand-alone project.

Installation

Forecaster is compatible and tested with PHP 7.1 and greater.

This package should be installed through composer using the following command:

Usage

You can use Forecaster to process arrays with casting and array placement. For example all the following basic types are included, int, integer, float, double, real, string, boolean and bool. You can also ignore the data type argument so no casting is done but the key will still be included.

Forecaster can also handle more complex array structures using dot notation.

A nice piece of functionality is that it can cast all the values of an array using the castAll method. There is even the option to do this using wild cards.

You need not use just arrays, you may also use an object or a mix of objects and arrays with the same dot notation.

Manipulating sub arrays is also relatively easy using the castItems method

Add your own fixed transformers

You can apply your own transformers to the Forecaster class statically making them available to all instances created.

Use functions for casting on the fly

Use classes for more complex casting

You can define transformers if you need to perform more complex logic that you wish to reuse.

Which can then be applied when using forecast.

Conditional transformations

Sometimes you might want to only perform some casting based on certain conditions. Forecaster provides a function for this that will only execute when the condition is truthy (e.g. == true).

You may also use a function to resolve the conditional.

Cast Into objects

If you're rather turn the result into an object of your choice you can provide a class string to the get method.

You can also provide the string object as a parameter which will instruct the forecaster instance to cast the array into a stdClass object.

There is also the option to resolve this using a function.

Using it with Laravel/Tighten Collections

If you have an array of items you'd like to cast that's already in a Laravel/Tighten Collection class a macro is available allowing you to do it seamlessly.

This macro also lets you specify the outcome of the forecast if you want to transform each of them into a particular class or an stdObject.

FAQ

Why no datetime converter?

Currently we feel this should be implemented by the user and not apart of the library due to how some developers only use datetime while others would use additional packages like Carbon or Chronos. We're open to ideas for this as it makes sense. We just don't want to put forward something that requires a breaking change early on.

Testing

Testing for this package is done using PHPUnit. You can run this from the composer dependencies. Running vendor/bin/phpunit will execute phpunit.xml.dist but you may copy it to phpunit.xml if you wish to change it for your own testing but please do not commit your version of phpunit.xml as part of any PR.

Contributing

If you wish to contribute to this project, please read the included contribution guide

License

This project is covered by the MIT license and can be read about the included license.md.


All versions of forecaster with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
tightenco/collect Version ^5.6
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 ylsideas/forecaster contains the following files

Loading the files please wait ....