PHP Classes

File: bootstrap.php

Recommend this page to a friend!
  Classes of Michael Cummings   PHP File Path Normalizer   bootstrap.php   Download  
File: bootstrap.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP File Path Normalizer
Get the full path of files relative to root
Author: By
Last change: Update of bootstrap.php
Date: 29 days ago
Size: 2,221 bytes


Class file image Download

 * Contains Bootstrap.
 * PHP version 7.1
 * This file is part of file_path_normalizer which is used to normalize PHP file
 * paths without several of the shortcomings of the built-in functions.
 * Copyright (C) 2014-2018 Michael Cummings
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see
 * <>.
 * You should be able to find a copy of this license in the
 * file. A copy of the GNU GPL should also be available in the file.
 * @copyright 2014-2018 Michael Cummings
 * @license LGPL-3.0+
 * @author Michael Cummings <>

use Composer\Autoload\ClassLoader;

 * Nothing to do if Composer auto loader already exists.
if (class_exists(ClassLoader::class, false)) {
 * Find Composer auto loader after striping away any vendor path.
$path = str_replace('\\', '/', dirname(__DIR__));
$vendorPos = strpos($path, 'vendor/');
if (
false !== $vendorPos) {
$path = substr($path, 0, $vendorPos);
$path .= '/vendor/autoload.php';
 * Turn off warning messages for the following include.
$errorReporting = error_reporting(E_ALL & ~E_WARNING);
/** @noinspection PhpIncludeInspection */
include_once $path;
$errorReporting, $path, $vendorPos);
if (!
class_exists(ClassLoader::class, false)) {
$mess = 'Could NOT find required Composer class auto loader. Aborting ...';
    if (
'cli' === PHP_SAPI) {
fwrite(STDERR, $mess);
    } else {
fwrite(STDOUT, $mess);