2017 © Pedro Peláez
 

library typo3-extbaseinstantiable

Small easy extbase object instantiation

image

castiron/typo3-extbaseinstantiable

Small easy extbase object instantiation

  • Tuesday, June 5, 2018
  • by gblair
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Extbaseinstantiable mixin for TYPO3

This package provides a mixin (read: trait) that lets you bestow the power of self-instantiation (using TYPO3 conventional mechanisms) to your classes. Add this mixin to any class to make it instantiable using the Extbase ObjectManager with ease., (*1)

Interface

Once you've mixed the trait into your class, you can call MyClass::get() to get an instance of the class., (*2)

Detailed usage

/**
 * Class MyClass
 */
class MyClass
{
    use \Castiron\ExtbaseInstantiable\Traits\ExtbaseInstantiable;

    /**
     * Some public interface
     */
    public function execute()
    {
        // yadda yadda whatever
    }
}

/**
 * Instantiate (with ObjectManager) and call a public method.
 */
MyClass::get()->execute();

Why do I want this?

A couple of reasons why this is handy: - It makes instantiating your class in TYPO3-world easy-peasy (vs GeneralUtility::makeInstance or ObjectManager::get called directly) - It uses ObjectManager::get under the hood, so automatic dependency injection works if you use annotations like @inject, (*3)

FAQ

Will it also respect marker interfaces like SingletonInterface?

Yes! It's using normal TYPO3 object instantiation under the hood, so all that weirdo magic will work., (*4)

Installation

composer require castiron/typo3-extbaseinstantiable

The Versions

05/06 2018

dev-master

9999999-dev

Small easy extbase object instantiation

  Sources   Download

MIT

The Requires

 

05/06 2018

1.0.1

1.0.1.0

Small easy extbase object instantiation

  Sources   Download

MIT

The Requires