Download the PHP package brekitomasson/laravel-support-helpers without Composer

On this page you can find all versions of the php package brekitomasson/laravel-support-helpers. 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 laravel-support-helpers

laravel-support-helpers

Helper methods in the spirit of Laravel's native Arr and Str. Also offers a fluid num($input) helper method that allows you to manipulate numeric inputs with ease.

Installation

Usage

This library can be used in three ways, all offering more or less the same features and functionality. They are:

  1. Instantiating the Number class with an input and running methods on the variable.
  2. Using the num() helper method.
  3. Calling static methods on the Num class.

Note that the second option, the fluid helper method, is merely a shortcut to the first option, and the two are functionally interchangeable. The input is parsed and cleaned - if given as a string, the input is reduced to only the numeric values detected in the string. Decimal points must be stated with periods, as commas in the input string are filtered out. The string '159,99' will be parsed as the whole number 15999.

The static methods are used internally by the library but can be called directly for simple one-off methods:

Available Methods

Note that most of these methods return an instance of Number and can be chained one after another. To get the current result, use the ->toNumber() method. The current value will be returned as a float or int based on whether it is a whole number or not.

add()

Increases the current value by the given input.

decimal()

Changes the current value to only the decimal portion of the current value. If the current value is a whole number, replaces the current value with 0. See integer() for the corresponding method.

factors()

Returns an array containing the factors of the current value (except 1 and the value itself). Requires the current value to be a whole number, as factors cannot be calculated from values with decimal numbers.

greaterThan()

Returns true or false depending on if the current value is greater than the given input. See lessThan() for the corresponding method.

inRange()

Returns true or false depending on if the current value is within a range defined by the two given inputs.

Accepts a boolean as a third argument (defaults to true) to determine whether to allow exact matches with the min and max values in the range.

integer()

Changes the current value to only the integer portion of the current value. If the current value is a whole number, no change is made. See decimal() for the corresponding method. Note that this does not round the current value to the nearest whole number.

lessThan()

Returns true or false depending on if the current value is less than the given input. See greaterThan() for the corresponding method.

over()

Divides the current value by the given input.

percentOf()

Changes the current value to how many percent of the given input it is.

roundToPart()

Rounds the current value to the given input's "parts of one". If the given input is 4, the current value is rounded to the nearest 1/4, or .25. If the given input is 10, the current value is rounded to the nearest tenth. ->roundToPart(1) is functionally equivalent to rounding to the nearest whole number.

sub()

Reduces the current value by the given input.

times()

Multiplies the current value by the given input.

withinRange()

Returns true or false depending on if the current value is within a given range of a given input. The first argument is the base value and the second argument is the range away from the base value to test.

Accepts a boolean as a third argument (defaults to true) to determine whether to allow exact matches with the min and max values in the range.

TODO

The following is a list of things that are missing or incomplete, and which will be added to the library over the next couple of patches/versions. None of these changes are expected to break backwards compatibility.

PRs are always welcome! If you add a method, please update the documentation and the test suite accordingly.


All versions of laravel-support-helpers with dependencies

PHP Build Version
Package Version
No informations.
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 brekitomasson/laravel-support-helpers contains the following files

Loading the files please wait ....