Installing Sonata Admin with Symfony 2.8 and PHP 7.2 - composer-php

I have an existing (and working) Symfony 2.8 project with Sonata Admin. It used to be installed on a server with PHP 5.6, but I have to move it to a server running PHP 7.2.
For some reason my composer.json was not in sync with its composer.lock so I'm trying to fix that but I'm lost in a dependency hell. Hoping someone here has a working setup similar to mine :)
I have a bunch of dependencies, but here are the ones that seem to be the culprits:
sonata-project/admin-bundle
sonata-project/block-bundle
sonata-project/core-bundle
sonata-project/datagrid-bundle
sonata-project/doctrine-orm-admin-bundle
sonata-project/intl-bundle
sonata-project/user-bundle
I used to have them in 2.2.*#dev, 2.3.*#dev or 2.4.*#dev but I now get conflicts when I require them this way. I eventually got a valid composer.lock with this config (notice I removed block-bundle because it is required by one of these):
"sonata-project/admin-bundle" : "2.3.10",
"sonata-project/datagrid-bundle" : "^2.2.1",
"sonata-project/doctrine-orm-admin-bundle": "^2.2.8",
"sonata-project/intl-bundle" : "^2.2.4",
"sonata-project/user-bundle" : "^2.2.5",
But the admin part of the site is broken with the following error:
Variable "sonata_admin" does not exist
I also got Block "preview" on template "SonataAdminBundle::standard_layout.html.twig" does not exist at some point, but can't remember when/how.
I know Sonata has a long history of making Composer dependency a complicated thing (because of its multiple packages and versions), and I've read numerous questions/issues on Stack Overflow and GitHub but couldn't find the one for me.
Has anyone found the perfect combination of requirements?
Would love to know!

Related

install introduction package in TYPO3 11 with composer

TYPO3 11 LTS with composer.
I tried:
composer require typo3/cms-introduction
the introduction package and bootstrap package are loaded.
Then i tried:
vendor/bin/typo3 extension:setup
but nothing happens. In the extensions manager i can see both extensions but no page in the page tree, nothing in the backend.
There are different descriptions out in the world:
composer exec typo3 extension:setup
results in this error message:
Script typo3 handling the __exec_command event returned with error code 255
It seems impossible to install the introduction package in TYPO3 11 with composer.
Any hints?
Thanks
Peter
I use always
vendor/bin/typo3cms install:setup
vendor/bin/typo3cms install:extensionsetupifpossible
and never had any problems, it requires this though:
"helhum/typo3-console": "^7.0.2"
I tested it with the introduction package too and the pages are created. The frontend is directly shown correctly after this.
My setup was completely based on composer, so there is no general problem to install the introduction package by composer.
If you want to repair the installation, keep care about the hint in the installation instruction:
If you want to re-install ext:introduction on an instance that had ext:introduction
loaded before, the data import is only performed if you (manually) remove the keys
marked with extensionDataImport in column entry_namespace from database table
sys_registry that are related to the introduction paths.
Note it is often easier to just install TYPO3 from scratch if you just want to play around.
TYPO3 and composer
Documentation related to composer is included in several documents:
TYPO3 installation
There exist two distributions that can be installed:
minmal is a very slim collection of system extensions.
base-distribution is a collection with most of the common system extensions.
naturally it's also possible to start with an individual composer.json file that is defining an own set of system extensions, so the packages above wouldn't be used.
It's also possible to install just an extension by composer without having installed TYPO3 before, then TYPO3 gets automatically installed as dependency if the extension defines at least one system extension as dependency.
Minor TYPO3 upgrade
Major TYPO3 upgrade
Explanation of composer.json for TYPO3
Furthermore there is an online helper for composer that makes it easier to collect all the desired packages for commandline:
https://get.typo3.org/misc/composer/helper
Note that it's not always better to install more packages and that not every package is available for every TYPO3 version.
typo3-console
The manual for the typo3-console can be found here:
https://docs.typo3.org/p/helhum/typo3-console/7.1/en-us/
You can switch the version in the top left corner of the manual.
The typo3-console can be used for non-composer installations too, it can be downloaded here:
https://extensions.typo3.org/extension/typo3_console
https://github.com/TYPO3-Console/TYPO3-Console/tags
TYPO3 v12
For TYPO3 v12 the typo3-console is not compatible yet (Oct. 7, 2022), so some steps in the install-process have to be done manually and are not available yet by command line.
All composer commands can be used and are not concerned by the missing console. Just in composer.json files usually this block is used and has to be removed until typo3-console is compatibel to v12:
"scripts":{
"typo3-cms-scripts": [
"typo3cms install:fixfolderstructure"
],
"post-autoload-dump": [
"#typo3-cms-scripts"
]
},

Class 'Illuminate\Routing\ControllerServiceProvider' not found While Upgrading from Laravel 5.1 to 5.2

I have a Laravel 5.1 install that I am upgrading. I meticulously followed the instructions available at https://laravel.com/docs/5.3/upgrade#upgrade-5.2.0 for the upgrade, including removing Illuminate\Foundation\Providers\ArtisanServiceProvider and Illuminate\Routing\ControllerServiceProvider from the config/app.php file (I am stressing this point, as googling for this issue has suggested this in every response).
Despite this, I am still getting this error when I run composer cache:clear
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Illuminate\Routing\ControllerServiceProvider' not found error
and see this error in my browser:
FatalThrowableError in ProviderRepository.php line 146:
Class 'Illuminate\Routing\ControllerServiceProvider' not found
Thinking that perhaps references to these classes were being cached, I checked bootstrap/cache/services.json and removed the references from there as well and then ran composer dump-autoload but I am still getting this error.
I also made sure to copy over example config/app.php from Laravel 5.2 clean install example here: https://raw.githubusercontent.com/ziyed/Laravel-5.2/master/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php
I have read through the similar threads on StackOverflow and Laracast and tried tried to use the advice contained inside, but nothing seems to work.
Any help would be greatly appreciated. For reference, my dev setup is running on a local XAMPP stack under a Windows 10 OS. The other environments are remote, using a traditional LAMP stack with Amazon Linux 2. I was trying to do the upgrade locally.
Illuminate\Routing\ControllerServiceProvider is not present anymore.
When I recently had to upgrade the same versions as you, I had to run composer update before and after removing Illuminate\Routing\ControllerServiceProvider::class and Illuminate\Foundation\Providers\ArtisanServiceProvider::class to make it work. Also worth to mention you need to clear bootstrap/cache. It worked for me.
Edit: i noticed now you tried the last step partially as well. You can remove all php files from cache.
I am closing this question, not because I found an answer, but because continuing down this path just didn't pass a cost/benefit analysis. After upgrading to 5.2, the next upgrade would be 5.3, and the breaking changes between 5.2 to 5.3 is a lot higher than between 5.1 to 5.2. After some thought, it was obvious that the better approach would be a fresh install on my target version, and then start porting over each module in my project by copying over the views, updating the routing, and making changes to the controllers and middleware as needed.
Or just using Laravel Shift.
Thank you to everyone who chimed in with suggestions!

Error "ionCube PHP Loader" after using composer. Magento 2 showing error. Please advise

I'm encountering this message:
"Site error: the ionCube PHP Loader needs to be installed. This is a widely used PHP extension for running ionCube protected PHP code, website security, and malware blocking.
Please visit get-loader.ioncube.com for install assistance"
I'm getting this message after using Composer/Magento commands (update, upgrade, compile, and deploy). I'm running a localhost install of Magento 2, which is now showing the following message.
"There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 629950493790"
I have looked for other solutions online but these solutions didn't fit. One solution seemed too risky, which was to change the name of my php.ini file to .php.ini (note the dot before). One solution advises to install a version of ionCube with the right PHP version, but since I'm working with PHP 7.0.* I'm not able to find that version of ionCube. I have also looked for the error that matches the error number I was given, but no luck.
I encountered these errors while trying to install a theme. I am new to Magento so I followed a guide that gave me a list of composed commands to go through. I selected the new theme through my admin's Configuration > Design, but noticed the design didn't really push through (cache or compile issue I think? I'm learning, if slowly.) I tried the command "composer update" but got my login credentials wrong.
My environment: Windows, XAMPP, PHP 7.0, Magento 2.2.8
If there are any resources that can help me, please let me know about them, incl. books. I really don't know how to proceed.
C:\xampp\htdocs\magento2> composer update
I want to be able to push the theme's visual changes, and safely and correctly clear the cache and update the files as needed.

Is there a way to tell Composer to install a package regardless of it's requirements?

I am working on a CakePHP 3.0 project which I want to update to 3.1-RC1. When I try do so I get an error:
Problem 1
- akkaweb/cakephp-facebook dev-master requires cakephp/cakephp 3.0.x-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
Now this plugin in question hasn't been updated in 6 months and I suspect it might work OK in CakePHP 3.1, so I would like to try it out.
How do I tell Composer to ignore this particular version incompatibility and proceed to update my CakePHP package?
I am aware of version aliases, but I only want the exception to be for the plugin in question, and not for everything else.
You should be frightened when you want to use a software that isn't maintained, hasn't released any tagged versions, and depends on developer branch versions of other important software. I wouldn't use this package at all. It will harm you in the long term, even if you made Composer install it.
If the current author does not respond to your contact attempts, you should be able to fork the project (in compliance with the license it gave you) and start maintaining the package by fixing the problems you have. Because that's what you'd have to do anyways when using unmaintained software. It will allow you to use this package in a much cleaner way, instead of coming up with a dirty Composer hack to make it install.

Installing yii2 framework using Xampp - do i need a github account?

A couple of years of go i used to program using PHP, but without frameworks. With these recent developments I've decided to get in the to the game and try using one. I've decided to use yii 2.0 .
I've read some of the documentation and in my opinion there is some lack of information (at least for who is getting started), so i´m having some problems installing yii 2.0 on my computer using Xampp. The PHP version is 5.5.9.
From what i could understand i downloaded the yii 2.0 framework, extracted the content and copied to c:\xampp\htdocs\yii2
I've already installed the composer, so the the next thing to do i think would be, using the cmd, do these two lines of code:
composer global require "fxp/composer-asset-plugin:1.0.0"
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
The problem is when i do the last one it asks for username and password i think of GitHub. Can you tell me if I'm obligated to have an account on github to install yii 2.0 framework.
Is there a way to get around this?
Yii2 is integrated with composer asset plugin. It allows download Bower and NodeJs packages through Composer.
Github account is required to overcome API rate limit. Here is the explanation from the main contributor of this extension:
It's a rate limit of Github API. In anonymous access, Github at a
greatly reduced limit (60/hr it seems to me), and we must be logged
with a token for have a much higher limit.
See composer/composer#1569 and composer/composer#1877
The problem also exists using Nodejs and Bower.
You can find it in this issue, it's 9th from the top.
I think workaround with installing Bower and the same packages is not an option, because initially and with each framework update you must manually synchronize packages with their versions and override some configuration. Also some extensions require javascript plugins and using composer asset plugin too. So you have to do the same with each of them too. It simply not worth it. And having account on Github for web developer nowadays is kind of de facto standard.
Just create Github account if you are still don't have one and everything should be fine. Earlier updating process was pretty slow, now it's faster and I found this approach pretty interesting and flexible.

Resources