Skip to content

Instantly share code, notes, and snippets.

View perrelet's full-sized avatar

perrelet

View GitHub Profile
@cwhite92
cwhite92 / fqcn_from_path.php
Last active August 26, 2024 16:17
Get the FQCN from a PHP file specified by file path
<?php
public static function fqcnFromPath(string $path): string
{
$namespace = $class = $buffer = '';
$handle = fopen($path, 'r');
while (!feof($handle)) {
$buffer .= fread($handle, 512);