Updating Imagemagick on Laravel 4 - laravel-4

On a project I'm working on, I need to update Imagemagick to at least 7.0.8, in order to have support for HEIC I'm uncertain how to do that, though.
In my composer.json file, I have this:
"require": {
"laravel/framework": "4.2.x-dev",
"intervention/image": "dev-master",
--- rest of composer.json ---
According to phpinfo(), that gets me ImageMagick 6.7.7-10.
I'm uncertain how to proceed to update ImageMagick (both locally, and eventually to the production environment) to the version I need.
I guess, first I need to ask, is this even possible under Laravel 4? (If it's not, then the rest of this becomes a moot point, because the project scope doesn't allow for the time to update the entire project to Laravel 5.)
If it is possible, what am I missing? Is there a simple package I can add?
Edit: This project is using PHP 5.6

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"
]
},

Installing Sonata Admin with Symfony 2.8 and PHP 7.2

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!

How to update Laravel Application (not the composer dependencies)

I have an question regarding updates to the framework of a Laravel application.
Normally I run the composer update command to update all of its dependencies. For the laravel framework the package laravel/framework is used.
But they made some changes in this package which require you to make changes in the core application (not in composer). The core application is the package laravel/laravel.
For example, in this commit they have made a function called confirmPassword() which refers to a file ConfirmPasswordController.php in the package laravel/laravel.
But this file didn't exists on my application because my application is not up-to-date.
My question
How do i keep my core application up to date?
Errors
See a typical example of updating the dependencies but not the application here.
First of all... This is not an easy question and IMO there are MANY possible scenarios... Depending on the code you developed, the packages you're using, the version you want to use, and so on...
Anyway This is what I would do in this situation:
Let's say for example I want to upgrade from version X to version Z where Z is two major / minor releases ahead of X
Step 1
Follow the next steps for one major / minor realease at time. Once I've tried to upgrade an application from Laravel 5.4 to 5.6 and it was completely broken. So I decided to upgrade to 5.5 and test the everything was working and, in case, block at that release. Luckily when I've upgraded from 5.5 to 5.6 (after code fix) I've managed to make everything work as it should.
Step 2
Upgrade the core framework and the plugins, check for errors during the upgrade and ofc, check the official documentation for any kind of compatibility problem
Step 3
Laravel has it's own upgrade guide that should be followed step by step. A good chunk of errors can be solved simply following that guide. There may be some plugins that doesn't provide it but usually the problems are releated to new features... It's hard that a method, class or trait has completely changed from one version to another.
Step 4
This step can be omitted, but from the example you've provided maybe it's better to add it. When there is a new feature that requires a specific class or trait or whatsoever, the simplest way to check if the error is thrown because of a file missing (and that is part of the "boilerplate") or has a different nature, is to create an empty project with that specific version and make a comparison with the "default" files.
For example, if you made no changes to the LoginController, checking if the new version has any kind of updates, may be the solution.
You can do this manually, following the upgrade guide for the version you're upgrading from/to, for example this one.
Alternatively, Laravel Shift is a paid but fairly inexpensive tool that will do it for you automatically. Since it's making changes to your project, you should carefully review everything it's done.

Can't install local extension in Bolt CM

I a trying to write an extension for Bolt CM. I decided I should start by just doing the tutorial they provide, although I can't get it to work. When viewed on the "Extend"-page in the CMS itself the extension shows up but does not work. Instead, it shows local/author/urlfield — [INVALID] — [DISABLED].
I'm quite sure that the problem is located in the extensions/composer.json file. I added the namespace of my extension to the "require" array (second from above):
"require": {
"sahassar/gmaps": "^4.0",
"myname/myexension": "^1.0",
"larsvanscheijndel/urlfield": "^1.0",
"wikimedia/composer-merge-plugin": "^1.3"
}
If I change the name of the extension in this file, it changes in the CMS aswell.
I really can't find where to use namespaces, where to use file locations, and whether to use all lower case, camel case or any other type of casing.
Can anyone help? All input is appreciated.

Exclude a package from updating in composer

Whenever I try to add a new package using composer like
"composer require packagename/package" or use "composer.phar update", I am getting all the installed packages updated. Is there any option in composer to exclude some package that I don't need to get updated?
run this command and see what is your package version:
composer show -i
go to composer.json and edit which package you want never change by composer update and write version correctly for that :
"jacopo/laravel-authentication-acl": "1.3.*",
change to :
"jacopo/laravel-authentication-acl": "1.3.11",
Done! now if you run composer update this package not update.
From my experience, the best way to exclude 1 or some packages is to use --interactive in composer update.
$ composer update --interactive
When you do this you can select which package you want to update and skip the package that you don't want to update.
You can supply the name(s) of a one or more packages to update:
composer update vendor1/package1 vendor1/package2 vendor2/*
and this will only update those packages.
This isn't specifically excluding, it's including, but it certainly makes updating specific packages much faster.
To avoid the update on using the require command, you'd could hand-craft the composer.json, (which isn't so hard) then run the above targetted update on the package you just added.
Also use --no-dev to exclude development packages (if you are not developing the packages you are depending on e.g. in production). This also speeds up the dependency analysis.
If you feel the need to exclude some of your packages from being updated, I'd consider this the beginning of getting into a dependency mess. You should clean up your dependencies now before it gets worse.
From my experience, the topmost reason not wanting to update a dependency is when you used a branch of a package instead of a released version. You should try to fix this as thoroughly as possible:
If you are using your own packages, tag a release version for the commits you want to use. Then switch your software to either use that exact version, or use a wildcard version requirement like 1.0.*, ~1.2 or ^1.3.4.
If you are using external code that you cannot influence directly, try to contact the developers of that code and ask them to tag a version. Tagging versions is important to maintain a sane dependency tree.
If you cannot make the external developers tag a version, find a way to tag it yourself:
Clone their repository on Github, tag a version, and include your copy of the repository instead of going to packagist.org.
Create the necessary metadata in a "type=package" repository entry in your composer.json file.
Or at the very least, when depending on the branch, assign it a version alias to allow for a smoother transition later when the external project starts tagging their versions. Note that this will not fix your current problems at all, but it may make things better in the future.
If all else fails, you might point to a certain commit id in your composer.json. This will
In general, you should always be able to run composer update unconditionally. If not, this is a warning sign for dependencies not properly declared in your own composer.json file.
The second reason for not wanting to update is incompatible changes in a package that were tagged as a bug fix instead of a major version increase. The solution for this would be simple:
First you'd have to investigate the reason for such an error: Was it really an incompatible API change? If yes, raise an issue with the developers of that package. They should create a new bug fix version with that incompatible update rolled back or fixed, and if they want to keep their change, they should tag it with a minor or major version increment, depending on what they changed.
If however you incorrectly used their code, somehow not using the public API, a bug fix is unlikely. You should try fixing your code by not using stuff that is not supposed to be the public API. For example, in recent versions of Symfony, the public API is explicitly tagged in the code and documentation - using something else will break at some point, even when doing "compatible" version updates like from 2.6.x to 2.7.x.
Another way to fix it would be to exclude the newer version inside the composer.json file: Instead of "external/package":"~1.2" you'd put "external/package":"~1.2,!1.2.5" if you find that version 1.2.5 broke your software. Or maybe you are afraid of further updates also breaking your software, you'd put in "external/package":"~1.2,!>=1.2.5".
One more thing to add: If you run composer require, you won't get updates for packages that are already installed. They are fixed. The required package will be selected based on all the installed versions, and it will only be installed if there is a version available that is compatible with all the versions already installed. Note that this will not work correctly if there are dependencies on branches of packages in both your own composer.json and the new package. The reason is that the branch name will be the same, but you'll never know which commit was being used. Maybe the new package uses a very recent commit of dev-master of a third package, and your own software a very old one, and there have been incompatible changes in between - this will break things without Composer being able to detect it.
Using composer require packagename/package, you require a new package and you get a partial update for just packagename/package and its dependencies.
composer update packagename/package can be used to trigger the same partial update, but then in case you already have packagename/package in your composer.json.
One workaround is to use replace property, however there isn't dedicated command for that, so you can run composer require foo/bar as usual (which will create composer.json), then add a new replace section for the package to ignore.
Or create composer.json file on your own. Here is the example:
{
"require": {
"radic/tmp-underscore-php": "1.2.0"
},
"replace": {
"patchwork/utf8": "*"
}
}
Once you run composer install, the required package patchwork/utf8 won't be downloaded.

Resources