npmweb/laravel-helpers

This package is abandoned and no longer maintained. No replacement package was suggested.

Laravel-specific helper functions.

1.0.1 2015-04-07 19:58 UTC

This package is not auto-updated.

Last update: 2017-03-06 09:56:46 UTC


README

Laravel-specific helper functions.

Installation

Add npmweb/laravel-helpers as a requirement to composer.json:

{
    "require": {
        "npmweb/laravel-helpers": "1.*"
    }
}

Update your packages with composer update.

Usage

The following helper methods are loaded by default:

String Helpers

  • pluralize( $num, $item ) - outputs a singular or plural description of a number of items, appropriate to the number. For example, '1 apple' or '2 apples'

Env Helpers

  • endpoint() - returns the name of the endpoint being accessed, for example 'frontend' or 'backend'. This is not a standard Laravel feature; it's a NpmWeb team convention. You can configure it by setting ENDPOINT in your .env file.
  • is_endpoint($endpoint) - returns true if the current endpoint is the specified one. You can also do is_frontend() or is_backend() if you're using either of those two endpoints.
  • is_env() - returns true if the current environment is the specified one, for example 'local' or 'production'. You can also do is_local(), is_dev(), is_test(), or is_production() if you're using one of those standard environments.

License

This code is open-sourced under the MIT license. For more information, see the LICENSE file.