npmweb / laravel-helpers
Laravel-specific helper functions.
Installs: 2 226
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 12
Forks: 0
Open Issues: 0
Requires
- laravel/framework: >=4.1
Requires (Dev)
- phpunit/phpunit: 4.2.*
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 settingENDPOINT
in your .env file.is_endpoint($endpoint)
- returns true if the current endpoint is the specified one. You can also dois_frontend()
oris_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 dois_local()
,is_dev()
,is_test()
, oris_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.