PHP Classes

Remote PHP PSR 4 Class Loader: PSR-4 compliant loader for remote classes

Recommend this page to a friend!
  Info   View files Documentation   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-08-28 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 73 All time: 10,012 This week: 171Up
Version License PHP version Categories
remote-psr4 1.0.1MIT/X Consortium ...5PHP 5, Language, PSR
Description Author

This package is a PSR-4 compliant loader for remote classes.

It defines a class loader for PHP classes that are loaded via HTTP from a given remote Web server.

The remote class loader is compliant with PSR-4 specification.

Innovation Award
PHP Programming Innovation award nominee
January 2020
Number 4
PSR-4 is a standard recommendation for building PHP class loaders that automatically load classes on the first time they are used during the execution of a PHP script.

This package provides a PSR-4 compliant loader that is able to load class files from remote Web sites using regular HTTP requests.

This allows sites to use functionality provided by third-party sites, thus without having to install those classes in the servers of those sites.

Manuel Lemos
Picture of Till Wehowski
  Performance   Level  
Name: Till Wehowski <contact>
Classes: 28 packages by
Country: Germany Germany
Age: 44
All time rank: 109370 in Germany Germany
Week rank: 287 Up9 in Germany Germany Up
Innovation award
Innovation award
Nominee: 10x

Details

remote-psr4

An php PSR4 Autoloader Client which is autoloading from a remote server. With remote Classmap and Aliases.

Server?

If you want to build an API Server for this client, you can install my Package frdl/codebase.

This is recommended for larger projects, please use my API Server only for testing, if want to use it productionaly or need a larger amount of load, please contact me! You can also contact me if you need any help with my packages, or if you need a webhosting plan!

Usage

   $loader = \Webfan\Psr4Loader\RemoteFromWebfan::getInstance('03.webfan.de', true, 'latest', true);

...or...

  $loader = \frdl\implementation\psr4\RemoteAutoloader::getInstance('03.webfan.de', true, 'latest', true);

...or...

$config = [
    'FRDL_UPDATE_CHANNEL' => 'latest',  // stable | latest
    'FRDL_REMOTE_PSR4_CACHE_DIR'=> \sys_get_temp_dir().\DIRECTORY_SEPARATOR. \get_current_user()
				                       .\DIRECTORY_SEPARATOR.'.frdl'.\DIRECTORY_SEPARATOR.'runtime'.\DIRECTORY_SEPARATOR.'cache'.\DIRECTORY_SEPARATOR
			                         .'classes'.\DIRECTORY_SEPARATOR.'psr4'.\DIRECTORY_SEPARATOR,    
     'FRDL_REMOTE_PSR4_CACHE_LIMIT'=>	24 60 60,                                
];

 // $workspace is the DEFAULT Psr4 Server
 $loader =  call_user_func(function($config,$workspace){
    return \frdl\implementation\psr4\RemoteAutoloaderApiClient::class::getInstance($workspace, false, $config['FRDL_UPDATE_CHANNEL'], false, false, 
	/Classmap (with PSR4 and Alias)/
       [
	 //Concrete Classes:     
        \frdlweb\Thread\ShutdownTasks::class => 'https://raw.githubusercontent.com/frdl/shutdown-helper/master/src/ShutdownTasks.php',
        \Webfan\Webfat\Jeytill::class => 'https://raw.githubusercontent.com/frdl/webfat-jeytill/main/src/Jeytill.php',	  
	    
      // NAMESPACES   = \\ at the end:
      'frdl\\Proxy\\' => 'https://raw.githubusercontent.com/frdl/proxy/master/src/${class}.php?cache_bust=${salt}',    	    
    
      // ALIAS = @ as first char:
      '@Webfan\\Autoloader\\Remote' => __CLASS__,	    
	    
      //Versions at Webfan:
	  // Default/Fallback Versions Server:
	\webfan\hps\Format\DataUri::class => 'https://webfan.de/install/?salt=${salt}&source=webfan\hps\Format\DataUri',	    
	 // Stable/Current Versions Server:   
        //\webfan\hps\Format\DataUri::class => 'https://webfan.de/install/stable/?salt=${salt}&source=webfan\hps\Format\DataUri',	    
	// Latest/Beta Versions Server:    
	// \webfan\hps\Format\DataUri::class => 'https://webfan.de/install/latest/?salt=${salt}&source=webfan\hps\Format\DataUri',
   ],
    $config['FRDL_REMOTE_PSR4_CACHE_DIR'],
    $config['FRDL_REMOTE_PSR4_CACHE_LIMIT']
  );
 }, $config,'https://webfan.de/install/'. $config['FRDL_UPDATE_CHANNEL'].'/?source=${class}&salt=${salt}&source-encoding=b64');
 
 $loader->register();

  Files folder image Files  
File Role Description
Files folder imagesrc (2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageimplementations (1 directory)
Files folder imageWebfan (1 directory)

  Files folder image Files  /  src  /  implementations  
File Role Description
Files folder imageautoloading (3 files)

  Files folder image Files  /  src  /  implementations  /  autoloading  
File Role Description
  Accessible without login Plain text file RemoteAutoloader.php Class Class source
  Accessible without login Plain text file RemoteAutoloaderApiClient.php Class Class source
  Accessible without login Plain text file RemoteFallbackLoader.php Class Class source

  Files folder image Files  /  src  /  Webfan  
File Role Description
Files folder imagePsr4Loader (1 file)

  Files folder image Files  /  src  /  Webfan  /  Psr4Loader  
File Role Description
  Accessible without login Plain text file RemoteFromWebfan.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:73
This week:0
All time:10,012
This week:171Up