PHP code example of mbs-dev / php-helpers

1. Go to this page and download the library: Download mbs-dev/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/ */

    

mbs-dev / php-helpers example snippets


use App\Helpers\Helpers;

use Symfony\Component\HttpFoundation\File\UploadedFile;

$helpers = new Helpers();
$mimeType = $helpers->getFileMimeType($uploadedFile);
echo $mimeType; // Outputs the mime type

$id = Helpers::extractIdFromApiUrl('https://api.example.com/resource/123');
echo $id; // Outputs: 123


$slug = Helpers::slugify('Hello World!');
echo $slug; // Outputs: hello-world

$uploadedFile = Helpers::createUploadedFile('/path/to/original.jpg', '/path/to/copied.jpg');

$code = Helpers::genererCodeAlphanumerique(10);
echo $code; // Outputs a 10-character alphanumeric code

$distance = Helpers::getDistanceBetweenPoints(40.748817, -73.985428, 34.052235, -118.243683, 'km');
echo $distance; // Outputs the distance in kilometers

$formData = $helpers->extractFormData($request);
print_r($formData); // Outputs the form data

$formData = Helpers::parseMultipartFormData($request);
print_r($formData); // Outputs the parsed form data
bash
composer