1. Go to this page and download the library: Download safronik/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/ */
safronik / helpers example snippets
HelperArray::insert( $array_passed by_link, $insert_position, $insert_value); // Modifies the array $array. Paste $insert on $position
// Scan directory and its subdirectories. Could filter the set by different parameters
HelperReflection::getClassesFromDirectory(
directory: string, // Directory path
namespace: string, // Directory namespace
[exclusions: string[] = [...]], // Exclusions. Full strict comparison
[filter: string = ''], // Positive filter (only string contains will be present in the result set)
[recursive: bool = false], // Scan subdirectories
[skip_infrastructure: bool = true], // Skip classes starts with '_' (underscore symbol)
[filter_callback: callable|null = null] // Any callback you want to filter the result set. Other methods of self could be passed as a callback filter
): array
// Filter everything except final classes from the given set
HelperReflection::filterFinalClasses(classes): array
// Filter everything except interfaces from the given set
HelperReflection::getInterfacesFromDirectory(classes): array
// Check if the given class use specific trait
HelperReflection::isClassUseTrait(classname: string, trait: string): bool
// Gets class traits
HelperReflection::getClassTraits(classname: string): array
// Filter everything except classes which are implement specific interface from the given set
HelperReflection::filterClassesByInterface(classes: array, interface: string): array
// // Check if the given class implements specific interface
HelperReflection::isClassHasInterface(class: object|string, interface: string): bool