Download the PHP package pfaciana/composer-smart-autoloader without Composer

On this page you can find all versions of the php package pfaciana/composer-smart-autoloader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package composer-smart-autoloader

ClassLoader

Overview

ClassLoader is an autoloading solution designed to handle PHP project structures with multiple Composer dependencies. It's useful when multiple composer.json files are include the same codebase and the same repo is included with different versions (like a WordPress site with multiple plugins that have a composer.json and vendor folder).

Purpose

The primary goal of ClassLoader is to enhance the reliability and consistency of autoloading in complex PHP applications. It addresses the common issue of "first loaded, first served" in traditional autoloading mechanisms, which can lead to missing features or inconsistent behavior when older versions of packages are loaded instead of newer ones.

Usage

To use ClassLoader in your project, you can simply get the instance and run it:

If you're using this in a WordPress plugin, you can run after all the plugins have loaded

If new vendor packages have been added since you last ran it, you can re-run it using the run method:

For example, you many want to run this ClassLoad right away, but then re-run after all plugins are installed

This will replace the cached class maps with the classes added since the last run.

NOTE: run() will automatically run just the first time you instantiate the ClassLoader. If you call getInstance() a second time, nothing will happen. If you want to re-run setting the class map, you need to call the run() method. If you don't want the ClassLoader to automatically execute run() at all, set the $run parameter to FALSE like \Render\Autoload\ClassLoader::getInstance( FALSE ); on instantiation.

Dump Autoloading (Optimize)

To ensure dependencies of dependencies are loaded in the same manner, you can run composer dumpautoload --optimize for each composer.json. This will still work without it, but those additional dependencies might fall back to the default Composer Autoload. If using WordPress, you can do this part of a hook that runs on a plugin install (assuming composer is installed on that server).

If you're only concerned with packages you/your team personally created, then you can make sure to run composer dumpautoload --optimize as part of your build process.

How It Works

  1. Version Analysis: ClassLoader analyzes the versions of all installed packages across different composer.json files in the project.
  2. Weight Calculation: It assigns weights to different versions of the same package, favoring more recent versions.
  3. Smart Loading: When autoloading classes, it prioritizes loading from the most up-to-date version of a package.
  4. Conflict Resolution: In case of version conflicts, it attempts to use the latest compatible version, reducing the risk of missing required features.

Key Features and Benefits


All versions of composer-smart-autoloader with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pfaciana/composer-smart-autoloader contains the following files

Loading the files please wait ....