2017 © Pedro Peláez
 

composer-plugin autoload-splitter

Composer plugin for splitting a generated autoloader into two distinct parts.

image

wp-cli/autoload-splitter

Composer plugin for splitting a generated autoloader into two distinct parts.

  • Wednesday, February 21, 2018
  • by schlessera
  • Repository
  • 3 Watchers
  • 4 Stars
  • 253,954 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 7 Versions
  • 22 % Grown

The README.md

WP-CLI Autoload Splitter Composer Plugin


⛔️ THIS PACKAGE IS OBSOLETE AS OF WP-CLI v2.0.0 ⛔️, (*1)


This is a custom autoloader generator for WP-CLI that generates two separate autoloaders that split up the autoloadable classes. This allows these independent groups of autoloadable classes to be registered at different times in the code execution path., (*2)

Using the default settings, it will produce the following two files:, (*3)

  1. vendor/autoload_framework.php
  2. vendor/autoload_commands.php

Usage

In your project's composer.json, require the wp-cli/autoload-splitter, and then optionally add the "extra" as needed to customize default behavior:, (*4)

{
    "require": {
        "wp-cli/autoload-splitter": "^0.1"
    },
    "extra": {
        "autoload-splitter": {
            "splitter-logic": "WP_CLI\\AutoloadSplitter",
            "splitter-location": "php/WP_CLI/AutoloadSplitter.php",
            "split-target-prefix-true": "autoload_commands",
            "split-target-prefix-false": "autoload_framework"
        }
    }
}

After the next update/install, you will have both a vendor/autoload_framework.php and a vendor/autoload_commands.php file, that you can simply include and use to autoload the individual groups of classes as needed., (*5)

Valid "extra" Keys

You can configure the Autoload Splitter by providing "extra" keys under the "autoload-splitter" root key., (*6)

  • "splitter-logic" :, (*7)

    Fully qualified class name of the class that contains the splitter logic. The class will be __invoke()d with two arguments, the fully qualified class name as well as the path to the class source file., (*8)

  • "splitter-location":, (*9)

    Location of the splitter logic class source file. This is used to manually require the class file in case it was not available to the Composer plugin through autoloading., (*10)

  • "split-target-prefix-true" :, (*11)

    Prefix that is used to generate the autoload files that contain the classes that evaluated to true through the splitter logic., (*12)

  • "split-target-prefix-false" :, (*13)

    Prefix that is used to generate the autoload files that contain the classes that evaluated to false through the splitter logic., (*14)

Current Limitations

"psr-0" & "psr-4" autoloaders

To be able to work on individual classes, this Composer plugin will transform all PSR-0 and PSR-4 autoloaders into class maps for the split autoloading functionality. This is similar to the --optimized switch when generating standard autoloaders. During development, you will need to re-run the autoload generation after making changes to class names or locations, so that the split autoloaders are updated., (*15)

To re-generate the autoloaders, just run composer dump-autoload from within the project's root., (*16)

"files" autoloaders

The "files" autoloading section is actually not a real autoloader. These files are eagerly included when the autoloader is triggered, and so they are simply ignored for the purposes of this Composer plugin., (*17)

License

This code is released under the MIT license., (*18)

For the full copyright and license information, please view the LICENSE file distributed with this source code., (*19)

The Versions

21/02 2018

dev-master

9999999-dev https://wp-cli.org

Composer plugin for splitting a generated autoloader into two distinct parts.

  Sources   Download

MIT

The Requires

  • composer-plugin-api ^1.1

 

03/08 2017

v0.1.5

0.1.5.0 https://wp-cli.org

Composer plugin for splitting a generated autoloader into two distinct parts.

  Sources   Download

MIT

The Requires

  • composer-plugin-api ^1.1

 

24/07 2017

v0.1.4

0.1.4.0 https://wp-cli.org

Composer plugin for splitting a generated autoloader into two distinct parts.

  Sources   Download

MIT

The Requires

  • composer-plugin-api ^1.1

 

03/05 2017

v0.1.3

0.1.3.0 https://wp-cli.org

Composer plugin for splitting a generated autoloader into two distinct parts.

  Sources   Download

MIT

The Requires

  • composer-plugin-api ^1.1

 

03/05 2017

v0.1.2

0.1.2.0 https://wp-cli.org

Composer plugin for splitting a generated autoloader into two distinct parts.

  Sources   Download

MIT

The Requires

  • composer-plugin-api ^1.1

 

03/05 2017

v0.1.1

0.1.1.0 https://wp-cli.org

Composer plugin for splitting a generated autoloader into two distinct parts.

  Sources   Download

MIT

The Requires

 

08/03 2017

v0.1.0

0.1.0.0 https://wp-cli.org

Composer plugin for splitting a generated autoloader into two distinct parts.

  Sources   Download

MIT

The Requires

  • composer-plugin-api ^1.1