TYPO3 8.7 Install an extension without composer - composer-php

I have a T3 8 project that was installed WITHOUT composer.
For the project I need the Ext t3api, which can only be installed (???) WITH composer.
Is it possible to install it somehow?

EXT:t3api is available via TER (https://extensions.typo3.org/extension/t3api). So it's installable via extensionmanager.
Another way would be uploading the extension's folder to typo3conf/ext/ (foldername = extensionkey - in this case "t3api"). Then the extensionmanager will find it and allow you to active/install it.
Update:
Dependencies to PHP packages (like some symfony/* packages) cannot be handled directly by TYPO3 (ext_emconf.php). Therefore, you have to build your own extension with the code of these packages and configure the appropriate autoloading.
There's already a good thread "How do I install Composer PHP packages without Composer?"

Related

composer - symlink for local extension Typo3 v12

I started using ddev about 3 years ago to develop my websites on typo3.
I followed this tutorial to be able to develop my exts locally:
https://t3planet.com/typo3-tutorials/install-local-typo3-extensions-composer-mode/
I noticed that since version 11 (and especially with version 12), symlinks can no longer be used to develop local extensions.
Is there an alternative way to be able to recreate the same functionality in typo3 v12 (composer 4)?
I read something on the subject in this link: but I don't understand how to configure it ...
https://docs.typo3.org/m/typo3/tutorial-getting-started/main/en-us/Extensions/Management.html
This is the correct tutorial, yes: https://docs.typo3.org/m/typo3/tutorial-getting-started/main/en-us/Extensions/Management.html#installing-local-extensions
Create a folder in project root, e.g. packages
Create your extension inside a sub folder in packages
Add a composer.json in your extension
Add the repositories part in your root composer.json (not extension)
Require the extension with composer req vendor/extension-name:#dev

How to fix installation of a package by Composer outside vendor folder

I am migrating a SilverStripe 3 website to SilverStripe 4 and in that process, I resorted to the silverstripe-ldap module. It comes with a dependency to symbiote/silverstripe-queuedjobs
The problem that I have is that symbiote/silverstripe-queuedjobs has its files installed by Composer in a queuedjobs folder at the same level than vendor, instead of being in vendor like all of the other dependencies.
Is it possible to force it to be installed in folder vendor?
All SilverStripe 3 modules install into the root project folder, rather than into the vendor folder.
In SilverStripe 4 this is still supported, but by default most modules (including all core and supported modules) install into the vendor folder.
If you've still got one in your root folder, you probably are installing an incompatible SilverStripe 3 version of that module. You should check the module on Packagist to find which version is SilverStripe 4 compatible (use ^4.5) and update your Composer constraints.

Installing Composer and Packagers - first time

I have never used Composer, but I want to use PHPSpreadsheet package, and it is recommended that Composer is used.
I am on a MAC using XAMPP and Netbeans.
I have installed Composer, and I have run the following command to get and install the PHPSpreadsheet package.
php ../../Composer/composer.phar require phpoffice/phpspreadsheet
I am running this in my project folder, (hence the ../../ to where Composer.phar is located.
This downloads the files into a vendor folder in my project folder.
What should I do then? Do I need to keep it in the Vendor folder, or can I move into a folder of my choice?
Netbeans has Composer options in the menus, but as far as I can see, this is for creating dependencies rather than installing packages.
I know I am totally missing the point of Composer somewhere, but have spent hours just trying to get this work.
Many thanks
You should really start with the docs -> https://getcomposer.org/doc/01-basic-usage.md
You have to keep the vendor directory - this is where all dependencies are kept. If you require more packages - then they will be installed in that directory.
After requring the package you have to load it so the PHP will know all the classes. Composer comes with great autolader. It is located by default in vendor/autoload.php. So what you have to do now is to require this file in your project. After that all classes from composer packages will be loaded automaticaly each time you use them in the code :)
I hope this will help you with this great tool. Cheers.

fuelphp No composer autoloader found

I got error message when install fuelphp
No composer autoloader found. Please run composer to install the FuelPHP framework dependencies first!
Also i my composer is updated.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
I am using PHP7 with a Vagrant environment.
Any idea about this error ?
It is not able to find installation of fuelphp. Most common issue is that index.php("public" or "public_html" folder) does not have the fuelphp's app, core and packages path set properly.
change DIR.'../ to DIR.'/../../(goes back one folder level)
There should be three of them.

How to skip suggestions when composer installing

Locally when I run composer install it doesn't show anything about suggestions. In our CI environment it provides a long list of suggestions I'd like to avoid. I want to see the output of what's being loaded from cache and that kind of thing, just don't want to see this. I've been through the docs and haven't been able to figure out how to hide this.
The suggestions are (among many others)...
symfony/security-core suggests installing symfony/expression-language (For using the expression voter)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
predis/predis suggests installing ext-phpiredis (Allows faster serialization and deserialization of the Redis protocol)
phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.)
phpseclib/phpseclib suggests installing pear-pear/PHP_Compat (Install PHP_Compat to get phpseclib working on PHP < 4.3.3.)
patchwork/utf8 suggests installing ext-intl (Use Intl for best performance)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
How can I hide this output?
As of composer 1.6.3, there is a --no-suggest option that hides all suggestions when running composer install or composer update.
When you run composer install on a project that has a composer.lock file, it just installs the versions locked in the composer.lock file and nothing. In other words, the required packages and versions are already resolved and it's just installing it.
When you run composer install on a project with no composer.lock file, Composer will resolve the required packages and their versions and will store it in the composer.lock file before installing them. In this case, the project was not set up and you get notified about other suggested packages.
In the second case, there is no way you can hide the suggested packages list from the output (at least, at the time of writing this answer). In the first case, nothing is new, so it isn't shown at all.
The solution will be to push your composer.lock file to the server, which is a good practice after all (you don't want your production server to have other versions of the dependencies than your dev environment, newer versions might broke your site).
Since composer 1.6.3, the --no-suggest doesn't show anything about suggestions. But in composer 2, this option is deprecated, it has no effect and will break in composer 3 (see this link for more details).
Hope that will help in 2021!

Resources