Download the PHP package carlcs/craft-helpers without Composer

On this page you can find all versions of the php package carlcs/craft-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 craft-helpers

Helpers plugin for Craft CMS

A collection of Twig functions.

Installation

The plugin is available on Packagist and can be installed using Composer. You can also download the latest release and copy the files into craft/plugins/helpers/.

File Helpers

The plugin provides functions, which allow to read and convert JSON, YAML, CSV and PHP file contents. Using the readText or inline function you can read an entire file into a string.

All functions take a path argument, this can be either a relative or absolute path, or full URL to the file. A relative path is interpreted as relative to the web root by default, but this can be changed with the basePath config setting.

Here are some ideas for what you can do with reading files:

readJson( path )

Reads a JSON file, parses and converts its contents.

readYaml( path )

Reads a YAML file, parses and converts its contents.

readCsv( path )

Reads a CSV file, parses and converts its contents.

readPhp( path )

Executes a PHP file’s return statement and returns the value.

readText( path )

Reads a file’s contents into a string. The plugin also provides an alias for this function with inline( path ).

String Helpers

truncate( length, suffix, preserve )

Truncates a string to a given length.

truncateHtml( length, suffix, preserve )

A version of the truncate filter that is capable of handling HTML as an input string. truncateHtml closes HTML tags, if they’d be cut off by the truncation. Please note that its performance is worse than the normal truncate filter, so only use it when you need to.

highlight( terms, format )

Highlights given terms in a text.

sentenceList( and, separator )

Generates a comma separated list from an array of strings, where the last two strings are joined with “and”.

titleize( ignore )

Returns a string with the first letter of each word capitalized.

collapseWhitespace

Trims the string and replaces consecutive whitespace characters with a single space. This includes tabs and newline characters, as well as multibyte whitespace such as the thin space and ideographic space.

stripWords( wordlist, ignoreCase )

Returns the input string stripped from all words of a given list of words.

stripPunctuation

Returns the input string stripped from all punctuation.

htmlEntityDecode

Returns the input string with all HTML entities converted to their applicable characters.

Number Helpers

numbersToWords( locale )

Converts a number to its word representation. The filter uses the Numbers_Words library to generate the output. Have a look at its documentation for a list of supported languages.

currencyToWords( locale, currency, decPoint)

Converts a currency value to word representation. The filter uses the Numbers_Words library to generate the output. Have a look at its documentation for a list of supported languages and currency symbols.

numeralSystem( numeralSystem, zero )

Converts a number (arabic numeral system) to a representation of that number in another numeral system. If applied to a rational number (float), the filter rounds it to the closest integer first.

unitPrefix( system, decimals, trailingZeros, decPoint, thousandsSep, unitSep)

Formats a number with unit prefixes.

fractionToFloat( precision )

Converts a fraction to a decimal number.

floatToFraction( tolerance )

Converts a decimal number to a fraction.

Miscellaneous Helpers

randomString( length, extendedChars )

Generates a random string of a given length.

md5( string )

Generates the md5 hash of a string.

json_decode( assoc, depth, options )

Decodes a JSON string.

setNotice( message )

Stores a notice in the user’s flash data.

setError( message )

Stores an error message in the user’s flash data.

Settings

You can override plugin defaults with a helpers.php config file, which you need to create in your craft/config/ folder.

basePath

The basePath is used by the inline and file reading functions. The default setting uses the value of your BASE_PATH environment variable if you have that set, otherwise falls back your the web root. You can override it with something like, for example CRAFT_CONFIG_PATH.'data/'.

highlightFormat

A setting for the highlight filter, which defines how matched terms are replaced. The term itself is available from the \1 backreference.

titleizeIgnore

List of words which should not be capitalized by the titleize filter.

Requirements


All versions of craft-helpers with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ~1.0
php Version >=5.4.0
danielstjules/stringy Version ^3.1
kwn/number-to-words Version ^1.3
league/csv Version ^8.2
symfony/yaml Version ^3.3
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 carlcs/craft-helpers contains the following files

Loading the files please wait ....