Download the PHP package ronanchilvers/utility without Composer

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

utility

Actions Status Scrutinizer Code Quality

The package is intended provides a set of classes and methods that help with common tasks in PHP projects.

Installation

Usage

Str - String handling

The Str class provides some useful methods for dealing with strings.

Str::plural($string, $count = 1, $plural = false)

Pluralise a string. Provide a singular word and count and plural() will pluralise it if appropriate. If its an odd word that doesn't pluralise easily, you can supply the plural you want to use as a third argument.

Str::singular($string, $count = 1, $singular = false)

Singularise a plural string. Provide a plural word and an optional count and singular() will do its best to singularise it for you. If it gets it wrong you can pass an explicit singular as a third argument.

Str::pascal($string, $allowed = [])

Convert a string to PascalCase. This method will by default remove any characters except a-z and 0-9. If you have additional characters you'd like to retain pass them as an array of strings in the $allowed argument.

Str::camel($string, $allowed = [])

Convert a string to camelCase. This method returns the same result as pascal() except that the first character of the returned string is lowercased.

Str::snake($string, $allowed = [])

Convert a string to snake_case. As with pascal(), this method removes all characters except a-z and 0-9. You can use the second argument $allowed to pass an array of additional characters that you want to keep.

Str::truncate($string, $length, $suffix = '...', $words = false)

Truncate a string to a given length. By default the string is suffixed with an ellipsis () but you can change this by passing a suffix string in the third argument ($suffix). In addition truncate() will split a string without regard for word boundaries. If you want to respect words pass true as the fourth $words argument.

Str::token($length = 64)

Generate a random string token of a given length.

Str::bool($string)

Determine if a string means true or false.

Testing

The utility classes are very simple and consequently have 100% test coverage. You can run the tests by doing:

The default phpunit.xml.dist file creates coverage information in a build/coverage subdirectory.

Contributing

If anyone has any patches they want to contribute I'd be more than happy to review them. Please raise a PR. You should:

License

This software is licensed under the MIT license. Please see the License File for more information.


All versions of utility with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 ronanchilvers/utility contains the following files

Loading the files please wait ....