1. Go to this page and download the library: Download rodrigomanara/alpha 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/ */
rodrigomanara / alpha example snippets
Manara\Alpha\Alpha;
$alpha = new Alpha();
// Analyze a string
$string = "Hello World 123!";
// Count different character types
$vowels = $alpha->checkVowels($string); // Returns: 3 (e, o, o)
$consonants = $alpha->checkConsonates($string); // Returns: 7 (H, l, l, W, r, l, d)
$numbers = $alpha->checkNumber($string); // Returns: 3 (1, 2, 3)
$special = $alpha->noalpha($string); // Returns: 2 (space, !)
$uppercase = $alpha->upper($string); // Returns: 2 (H, W)
$lowercase = $alpha->lower($string); // Returns: 8 (e, l, l, o, o, r, l, d)
// Get average word length
$average = $alpha->calculateWordLetterAverage("hello world php"); // Returns: 5
// Retrieve collected results
$results = $alpha->getAll(); // Get all collected data
print_r($results);
$alpha = new Alpha();
// Calculate average characters per word (rounded up)
$average = $alpha->calculateWordLetterAverage("I am testing this library");
// Words: I(1), am(2), testing(7), this(4), library(7)
// Average: (1+2+7+4+7)/5 = 4.2 → rounds to 5
$alpha = new Alpha();
// Analyze and store results
$alpha->checkVowels("hello");
$alpha->checkNumber("abc123");
// Retrieve specific results
$vowels = $alpha->get('vowels'); // Array of vowels found
$numbers = $alpha->get('numbers'); // Array of numbers found
// Get all collected results
$allResults = $alpha->getAll();
// Output:
// [
// 'vowels' => ['e', 'o', 'o'],
// 'numbers' => ['1', '2', '3']
// ]