roy404 / utilities
A comprehensive collection of PHP utilities including Carbon, Logger, Storage, RateLimiter, Cache, and Session Handler, and more designed to enhance productivity and simplify development.
Requires
- php: ^8.1
- phpmailer/phpmailer: ^6.9
- roy404/artisan: ^1.0
- roy404/blades: ^1.0
- roy404/eloquent: ^1.0
- roy404/request: ^3.0
- roy404/routes: ^4.1
- roy404/schema: ^1.0
- dev-main
- v5.5.6
- v5.5.5
- v5.5.4
- v5.5.3
- v5.5.2
- v5.5.1
- v5.4.10
- v5.4.9
- v5.4.8
- v5.4.7
- v5.4.6
- v5.4.5
- v5.4.4
- v5.4.3
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.10
- v5.3.9
- v5.3.8
- v5.3.7
- v5.3.6
- v5.3.5
- v5.3.4
- v5.3.3
- v5.3.2
- v5.3.1
- v5.2.10
- v5.2.9
- v5.2.8
- v5.2.7
- v5.2.6
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.10
- v5.1.9
- v5.1.8
- v5.1.7
- v5.1.6
- v5.1.5
- v5.1.4
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.9
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.0.9
- v3.0.8
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.9.9
- v1.9.8
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.8.10
- v1.8.9
- v1.8.8
- v1.8.7
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.9
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
This package is auto-updated.
Last update: 2025-06-25 16:24:24 UTC
README
A comprehensive collection of essential PHP utilities designed to streamline development and enhance productivity. This library includes versatile tools for common tasks, offering a robust foundation for building efficient and maintainable applications.
Installation
composer require roy404/utilities
🚀 Features
This library includes a range of utility classes to handle common development needs:
- Cache: Simplified caching interface for fast, temporary storage.
- Carbon: Simplified date and time manipulation.
- Config: Easy access to configuration files and environment-based settings.
- Logger: Lightweight logging system to track events, errors, and debug output.
- Mail: Utility for sending emails with flexible transport options.
- Storage: Easy-to-use file storage and management with support for local and cloud-based disks like AWS S3.
- RateLimiter: Control access frequency and throttle requests effectively.
- Server: Useful helpers for interacting with server and request data.
- Cache: Lightweight caching system to improve performance and reduce database overhead.
- Session: Streamlined session management and flash messaging.
- Storage: Unified file storage interface for local or cloud drivers.
This library is modular, lightweight, and optimized for seamless integration into your PHP projects. Whether you're working on a small application or a large-scale system, PHP Utilities Library provides the tools you need to get the job done efficiently.
Standards Helper Functions
A collection of helper functions used across the application to simplify common tasks such as session management, config access, cookie encryption, view rendering, CLI handling, CSRF protection, and more.
🚀 Usage
Below are some common usage examples:
session('user_id'); // Get session value config('APP_NAME', 'default'); // Get config value and fallback default value csrf_token(); // Get or create CSRF token encrypt('Secret123'); // Encrypt a string decrypt($encoded); // Decrypt an encoded string view('users.profile', [...]); // Render a view dump($data, true); // Debug and halt
🧩 Function Reference
session(string $key): mixed
: Retrieve a session value by key.config(string $key, mixed $default = null): mixed
: Fetch a config value. Auto-loads .env if not loaded.csrf_token(): string
: Returns a CSRF token, generating it if not present.encrypt(string $string): string
: Encrypts a string by encoding characters with specific prefixes.decrypt(string $encoded): string
: Reverses the encrypt() function to return the original string.launch_cli_session(array $args, string $path = '', string $root = ''): void
: Starts a CLI session using the Terminal class.view(string $path, array $data = []): string
: Renders a PHP or Blade view file and returns the HTML content.dump(mixed $data, bool $exit = false): void
: Pretty prints debug info (HTML formatted). Halts if $exit = true.str_limit(string $value, int $limit = 100, string $end = '...'): string
: Limits string length and appends $end if truncated.