Download the PHP package mconsult/anfi-debug without Composer
On this page you can find all versions of the php package mconsult/anfi-debug. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mconsult/anfi-debug
More information about mconsult/anfi-debug
Files in mconsult/anfi-debug
Package anfi-debug
Short Description A Laravel package for caching and viewing debug variables in Octane apps.
License
Informations about the package anfi-debug
Custom Debugging Package for Laravel Octane
This package provides a custom debugging solution for Laravel applications using Octane, where traditional debugging tools like Xdebug might not be available. It allows developers to cache variables and view them in a modern, user-friendly web interface that updates every 5 seconds.
Table of Contents
- Introduction
- Features
- Installation
- Configuration
- Usage
- Cache Variables with
_debug()
- Remove Cached Variables with
_forget()
- View Cached Variables
- Cache Variables with
- Full Example
- Security Considerations
- Customization
- Compatibility
- License
- Contributing
- Contact
Introduction
This package offers a custom debugging solution for Laravel applications running with Octane, allowing developers to cache variables and display them in a modern, user-friendly web interface that automatically updates every 5 seconds.
Features
- Cache Variables: Allows you to cache any variables for debugging purposes.
- User-Friendly Web Interface: View cached variables in a modern and easy-to-use web interface.
- Automatic Refresh: The interface updates every 5 seconds to display the latest values.
- Easy Installation: Simple installation via Composer.
- Laravel Compatibility: Supports Laravel 8.x, 9.x, 10.x, and 11.x.
Installation
Step 1: Require the package using Composer.
Note: Ensure your composer.json
includes the repository if necessary.
Step 2: Publish the package assets.
This command will copy the CSS files to your public
directory and the views to your resources/views/vendor
directory.
Configuration
No additional configuration is required. The package automatically registers its Service Provider through Laravel's package discovery.
Usage
Cache Variables with _debug()
Use the global _debug()
function to cache variables for debugging.
Example:
-
Parameters:
array $variables
: An associative array of variables to cache.string $key
(optional): A custom key for the cache entry.
- Returns:
string
: The key used to store the variables in the cache.
Using a Custom Key:
Remove Cached Variables with _forget()
To remove cached variables, use the global _forget()
function.
Example:
-
Parameters:
string $key
: The key of the cached variables to remove.
- Returns:
bool
:true
if the key existed and was removed,false
otherwise.
View Cached Variables
Navigate to the following URL in your browser to view the cached variables:
- Replace
{key}
with the key returned by the_debug()
function.
Example:
The interface will display the cached variables and automatically refresh every 5 seconds to reflect any changes.
Full Example
Here's a complete example of how to use the package:
Security Considerations
- Do Not Use in Production: Ensure that the debug routes are not accessible in production environments, as they may expose sensitive data.
- Route Protection: Consider protecting the debug routes with authentication or by restricting access to certain IP addresses.
Customization
- CSS Styling: You can modify the CSS file located at
public/vendor/debug-package/css/debug.css
to change the appearance of the debug interface. - Views: The views are published to
resources/views/vendor/debug-package
. Feel free to customize them as needed.
Compatibility
- Laravel Versions: This package supports Laravel 8.x, 9.x, 10.x, and 11.x.
- PHP Versions: Requires PHP 8.0 or higher.
License
This package is open-sourced software licensed under the MIT license.
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss changes.
Contact
If you have any questions or need support, please open an issue on the GitHub repository.