Download the PHP package internetguru/laravel-common without Composer
On this page you can find all versions of the php package internetguru/laravel-common. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-common
Laravel Common
This package provides handy utilities for Laravel applications.
Branch | Status | Code Coverage |
---|---|---|
Main | ||
Staging | ||
Dev |
Installation
You can install the package via Composer:
Run Tests Locally
In Visual Studio Code you can simpy use Ctrl+Shift+B
to run the tests.
To run the tests manually, you can use the following commands:
Helper Methods ~ Globals
The
Helpers
class provides useful methods for Laravel applications.
Configuration and example usage:
-
Add the following lines to the
config/app.php
file: - Use
Helpers
class methods in your application:
For all available methods, see the Helpers class.
Helper Macros
Package registers a set of useful macros for Carbon and Numbers. See the macros.php file for the complete list.
Example usage:
CheckPostItemNames
Middleware
Middleware that checks for invalid POST parameter names containing dots
"."
. This middleware helps prevent issues with Laravel's input handling. Throws an exception in non-production environments and logs a warning in production.
To use the middleware for the web
group, add the following lines to the bootstrap/app.php
file:
Alternatively, you can assign the middleware to specific routes or controllers as needed.
Example:
-
When a POST request contains parameter names with dots:
-
In Non-Production Environments: The middleware will throw an exception with the message:
- In Production Environment: The middleware will log a warning:
Translation Service Provider
Logs missing translations and translation variables in the current language. Throws an exception when not in production environment. In debug mode, checks all available languages.
- Logs warning when a translation key is missing or a variable required in a translation string is not provided.
- Checks all languages in debug mode from all available locales.
- Throws exception
InternetGuru\LaravelCommon\Exceptions\TranslatorException
instead of logging when the app is not in production mode.
To use the provider, add the following lines to the config/app.php
file:
Carbon Interval Cast
Casts a string to a
CarbonInterval
and back.
Example usage:
Breadcrumb Blade Component
Renders breadcrumb navigation based on routes matching the current URL segments. Supports translations with short and long labels, custom divider, and segment skipping.
Key Features:
- Customizable Divider – Allows a custom divider symbol between breadcrumb items.
- Short and Long Labels – Using
trans_choice
if available shows n-th right translation based on the item positon. - Segment Skipping – Skips a specified number of URL segments. Useful for nested routes or routes with prefixes (e.g. language).
Usage:
Example:
-
Assuming you have the following routes defined:
-
And your translation files (resources/lang/en/navig.php) include:
-
When you visit the
/products/123
URL, the short translation will be used for thehome
andproducts.index
routes. -
When you visit the
/products
URL, the short label will be used for thehome
route. - When you visit the
/
URL, the long label will be used for thehome
route.
System Messages Blade Component
Renders system temporary success messages and persistent error messages in different colors, with a close button.
Include the component in your Blade template where you want the system messages to appear:
Form Blade Components
The package provides a set of Blade components for form and various inputs.
Notes:
- The Google Recaptcha V3 service is enabled by default. To disable it, set the
recaptcha
attribute tofalse
. - You need to install the internetguru/laravel-recaptchav3 package for the Recaptcha to work.
Complete example:
Language Switch Blade Component
Renders a language switcher as a list of links with the current language highlighted.
Include the component in your Blade template where you want the language switcher to appear:
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-common with dependencies
torann/geoip Version ^3.0
spatie/laravel-ignition Version ^2.9
livewire/livewire Version ^3.6
internetguru/laravel-recaptchav3 Version dev-master