[TYPO3-english] TYPO3 via Composer integration
invisible.kinder at gmail.com
Tue Mar 17 19:41:05 CET 2015
I'd like to use Composer's autoloader in TYPO3 project and ude it not only for core classes, but also for our custom extensions (which will not be published to TER nor to Packagist).
Second goal is to have "vendor" directory out of www-root folder.
Third goal is to be ready for 7.x, while we're on a 6.2 still.
After reading lot  of  articles  and personal tries and errors I found that following is minial contents of composer.json, located at your root:
I had to adjust repositories location, becasue for some reason composer wasn't able to get TYPO3 from Packagist by default.
I had to add "Packages/Libraries" as vendor dir, because Bootstrap of TYPO3 6.2 in combination with environment variable TYPO3_COMPOSER_AUTOLOAD looks exactly into these folders located either in www-root or one folder upper .
So far so good.
If I want to include any other public extension into project, it is also possible with "require" section.
But how should I correctly include our custom extensions?
My first approach was to put them into "replace" section with "self.version", but seems, that Composer does nothing with them: resulting psr-4 class-map doesn't contain section, mentioned in "autoload" of typo3conf/ext/my_ext/composer.json.
Second idea was to include extension in normal "require" section, but then it means, that each of our custom extensiosn must have it's own repository, which would comjplicate the structure.
Third idea was to remove any ext/my_ext/composer.json from custom extensions and put all psr-4 mappings into "autoload" section of root composer.json. This means, that also some external libraries dependencies need to be put there es well.
This solution looks like the most suitable, though it is not the most "clean".
What are the best practives or your own experience here?
More information about the TYPO3-english