2017 © Pedro Peláez
 

contao-module contao-namespace-class-loader

Namespace class loader for Contao Open Source CMS

image

terminal42/contao-namespace-class-loader

Namespace class loader for Contao Open Source CMS

  • Wednesday, April 18, 2018
  • by aschempp
  • Repository
  • 5 Watchers
  • 5 Stars
  • 7,006 Installations
  • PHP
  • 20 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

Namespace Class Loader for Contao 3

This extension implements a valid PSR-0 class loader for Contao 3. The implementation is based on the Composer\Autoload\ClassLoader., (*1)

This extension is outdated, see the Upgrade information!, (*2)

Usage

Place all files in system/modules/_autoload in your Contao installation., (*3)

Usage works similar to the Contao class loader, except that you do not need to include every class file if you follow PSR-0 standards. Use the following example to implement the class loader in your config/autoload.php:, (*4)

<?php

/**
 * Register namespace
 */
NamespaceClassLoader::add('Isotope', 'system/modules/isotope/library');

Upgrade to Contao 4

In Contao 4, the only way to install extensions is using Composer. Therefore, you will not need this extension but should use Composer's class loader., (*5)

To be compatible with Contao 3 extension repository and Contao 4, you will need to require at least Contao 3.3 and set it up as follow:, (*6)

  1. Define your namespaces or classes in composer.json.
  2. Remove the dependency for terminal42/contao-namespace-class-loader from your composer.json
  3. Keep the dependency in the old Extension Repository
  4. Make _autoload an optional dependency in your autoload.ini like so:, (*7)

    requires[] = "*_autoload"
  5. Only call NamespaceClassLoader in your autoload.php if the class is actually available:, (*8)

    if (class_exists('NamespaceClassLoader')) {
        NamespaceClassLoader::add( ... );
    }

If the extension is installed via Composer, the classes will be loaded by the Composer autoloader. When installed using the old extension repository, the _autoload extension will be added and the classes will work like before., (*9)

See our commit on how we accomplished this in [Isotope eCommerce][3]., (*10)

The Versions

18/04 2018

dev-master

9999999-dev

Namespace class loader for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

contao classloader

18/04 2018

1.0.3

1.0.3.0

Namespace class loader for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

contao classloader

08/01 2015

dev-develop

dev-develop

Namespace class loader for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

contao classloader

08/01 2015

1.0.2

1.0.2.0

Namespace class loader for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

contao classloader