PHP Classes

File: src/autoload.php

Recommend this page to a friend!
  Packages of Saurabh Gayali   Uniprot PHP Class   src/autoload.php   Download  
File: src/autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Uniprot PHP Class
Access a UniProt Protein sequence REST API.
Author: By
Last change:
Date: 2 months ago
Size: 496 bytes
 

Contents

Class file image Download
<?php
/**
 * UniProt PHP Library Autoloader
 *
 * Simple PSR-4 autoloader for the library.
 * Include this file once to load all library classes.
 */

spl_autoload_register(function ($class) {
   
$prefix = 'UniProtPHP\\';
   
    if (
strpos($class, $prefix) !== 0) {
        return;
    }
   
   
$relativeClass = substr($class, strlen($prefix));
   
$file = __DIR__ . '/' . str_replace('\\', '/', $relativeClass) . '.php';
   
    if (
file_exists($file)) {
        require
$file;
    }
});