Download the PHP package fenetikm/autoload-drupal without Composer

On this page you can find all versions of the php package fenetikm/autoload-drupal. 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 autoload-drupal

Drupal 8 Composer Autoloader

A Composer plugin to add Drupal 8 autoloading of modules to the composer autoloader.

Why?

Why would you want this? Doesn't Drupal 8 have its own autoloading mechanism?

There are quite a few handy types of tools (e.g. static analysis, intellisense) that rely on being able to load all classes via the composer autoloader. Unfortunately, as Drupal 8 does its own autoloading at boot time, using these tools at best becomes slow (if you try to boot Drupal on the fly) or at worst becomes impossible (because you are running Drupal inside a VM). Some IDEs (e.g. PHPStorm) get around this by implementing their own discovery mechanism but if you are using an IDE or editor that doesn't do this you are out of luck.

This plugin plugs this gap.

How

This plugin is heavily based off of the Composer Merge Plugin. Essentially this plugin creates a composer.json file in memory including in all the specified modules to an autoload section and merges it into the root composer.json file, also in memory.

Installation

Require the plugin in your composer.json

Standard stuff:

Configure modules to autoload

This plugin is configured via the extra section in your composer.json. Usually you would want the app/modules/contrib/, app/core/modules/ and the app/modules/custom/ directories included. As Drupal can be configured in many ways, none of this is assumed and so all must be added in.

You can also constrain which modules are added in from a directory by specifying an array that follows the pattern of [ "directory_to_include", [ "module1", "module2" ] ].

For example:

Here, all modules in app/modules/contrib/ are added in, all modules in app/core/modules/ are added in and only the my_module module is added in from the app/modules/custom/ directory.

NOTE: only modules with src directories will be added in (since they conform to PSR for class autoloading).

Configure classmap

Additionally you may also add in classes that are outside of modules. A typical example is adding in the Drupal testing classes. e.g.

This will add in all the classes in that directory such as UnitTestCase, AssertHelperTraitTest etc.

Rebuild the autoloader

The composer autoloader with the Drupal modules will get generated at install and update. To manually force the refresh of it, do:

Result

If you have set it up successfully you will see something like the following in your vendor/composer/autoload_psr4.php file:


All versions of autoload-drupal with dependencies

PHP Build Version
Package Version
Requires composer-plugin-api Version ^1.1|^2
composer/composer Version *
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 fenetikm/autoload-drupal contains the following files

Loading the files please wait ....