PHP code example of olakunlevpn / php-helpers
1. Go to this page and download the library: Download olakunlevpn/php-helpers library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
olakunlevpn / php-helpers example snippets
use Olakunlevpn\PhpHelpers\Util;
// Now you can use Util:: functions
// Generate a JSON response
Util::json_message("Operation completed successfully", true);
// Redirect to a specific URL
Util::redirect_to("/home");
// Get the current URL
$currentUrl = Util::get_current_url();
// Check if it's an AJAX request
$isAjax = Util::is_ajax_request();
// Generate a Gravatar URL
$gravatarUrl = Util::gravatar("[email protected]", 120, 'identicon', 'pg');
// Generate a avatar with first name and last name
$avatarUrl = Util::avatar("John Timothy");
// Sanitize a string key
$sanitizedKey = Util::sanitize_key("user@123");
// Perform string operations
$studlyString = Util::studly_case("hello_world");
bash
composer