I got TYPO3 v10.2 running without Composer. I am creating an extension and want to include some third party PHP libraries into my Extbase Extension. I already read in the TYPO3 docs that those should be placed in Resources/Private/PHP/ThirdPartyLibrary
but how can I include them there ? Is it still possible with composer require
or should I just download the third party library resources and unzip it there ? How can I use the namespace/Classes from the external Library in the Controller or general in my Extension ?
What is the best way to do this without AND with composer ? Would like to know both ways. Thanks so far!
You have more ways to install TYPO3 via composer: Install regular via loading the needed packages. Use Composer helper to generate the composer command. Install the cms-base-distribution package.
The recommended way of installing TYPO3 is via Composer, as described on this page. If you do not want to use Composer, follow the package installation guide. You have more ways to install TYPO3 via composer: Install regular via loading the needed packages. Use Composer helper to generate the composer command.
Use Composer helper to generate the composer command. Install the cms-base-distribution package. This is helpful when you are use ddev, because it configures your database and mailserver for Mailhog. To create a new TYPO3 project using the TYPO3 Base Distribution:
To create a new TYPO3 project using the TYPO3 Base Distribution in a ddev environment: For Windows users: To install TYPO3 via the composer command, it should be started as admin or explicitly given the right to create symlinks (use for example a powershell or git bash started with admin rights).
composer init
composer req <neded packages>
composer u
vendor/
into your your_extension/Resources/Private/PHP/ThirdPartyLibrary/
vendor/
that you just moved.They placed the external library in Resources/Private/Shariff/vendor/
https://bitbucket.org/reelworx/rx_shariff/src/master/Resources/Private/Shariff/
https://bitbucket.org/reelworx/rx_shariff/src/master/Classes/Shariff.php
The libraries need to have namespaces already if you want to use them in your controller.
Since your in TYPO3 V10 you can use the new symfony dependency injection that is implemented into TYPO3 now: https://usetypo3.com/dependency-injection.html
your_extension/Classes/Controller/YourController.php
/**
* @var ThirdPartyLibrary
*/
protected $thirdPartyLibrary;
/**
* @param ThirdPartyLibrary $thirdPartyLibrary
*/
public function __construct(ThirdPartyLibrary $thirdPartyLibrary)
{
$this->thirdPartyLibrary = $thirdPartyLibrary;
}
your_extension/Configuration/Services.yaml
services:
_defaults:
autowire: true
autoconfigure: true
public: false
Vendor\Namespace\:
resource: '../Resources/Private/PHP/ThirdPartyLibrary/*'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With