spoom-php/composer

Autoloader (for nested classes) and installer for the Spoom packages

Installs: 72

Dependents: 5

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:composer-plugin

v1.1.1 2019-05-18 20:13 UTC

This package is auto-updated.

Last update: 2024-04-19 07:35:55 UTC


README

Composer plugin for Spoom packages to provide nested class support, and handle package installation.

Usage

To use the installer, simply set the package type to be spoom (the installer supports spoom-extension too until v2.0.0) in your composer.json, and add it as a dependency like the following:

{
  "type": "spoom",
  "require": {
    "spoom-php/composer": "^1.1.0"
  }
}

Autoload

The autoloader is extend the standard PSR-4 namespace definitions with nested class support. This means you could put more class in one file as long as the class name begins with the file's name, and the remain part MUST be separated with an uppercase letter (numbers always considered as a lowercase letter). For example the ExampleClassInterface class' files can be:

  • ExampleClassInterface.php
  • ExampleClass.php
  • Example.php

Public files

Packages can define directories (or files) to copy into the Spoom's public directory during the installation process. It's useful for editable configuration or localization files. This can be done with adding an extra information into composer.json:

{
  "extra": {
    "spoom": {
      "public": {
        "relative/path/to/source/": "relative/target/path/",
        "Autoload.php": "spoom-composer/directory/Autoload.php"
      }
    }
  }
}

Target path SHOULD start with a directory named after package's id and it will be relative from the Autoload::DIRECTORY directory.