composer - update cakephp app - php

I have a cakephp app with following in the composer.json
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "~3.0",
...
},
If I update it using: composer require cakephp/cakephp:"~3.3", I get:
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "~3.3",
...
},
however, cakephp v3.3 requires php version 5.5.9, so I wonder what composer command should I use to update json file to the following
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": "~3.3",
...
},

The whole point of a dependency manager is so you don't have to worry about dependency trees yourself.
Since you depend on cakephp/cakephp ~3.3, and it depends on php >=5.5.9, your application implicitly depends on that same version.
This doesn't conflict with your current dependency on php >=5.4.16, but you can probably remove your PHP dependency entirely.

Related

PHP Laravel 5.7 Tymon/jwt-auth Not Installing

Trying to install the Tymon/jwt-auth package and work with it, following the directions on the site: https://jwt-auth.readthedocs.io/en/develop/laravel-installation/ Doesn't seem like the publish configuration seems to do anything, I'm not seeing a config/jwt.php file, and the command php artisan jwt:secretdoesn't do anything useful, saying that there are no commands defined in the "jwt" namespace.
Does anyone have any info on getting JWT working on Laravel 5.7?
Verified that it is in the composer.json:
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0",
"tymon/jwt-auth": "^0.5.12"
},
It would be nice to get this released soon you can just using this
"tymon/jwt-auth": "dev-develop"
That worked for my project
Go to composer.json. Add this to require: "tymon/jwt-auth": "^1.0.0". Then run php composer update. The version of jwt 0.5 is not suported by carbon 2.0. This worked for me with laravel 5.8.

composer custom repository package can't pull dependency

Running into an issue with composer. I have a main project that im working on with some some small libraries I built that I want to more easily share between my projects. They are nowhere near release ready, so I do't want to add them to packagist, but when I require 1 that requires another, it will error unless I ad that custom repository as well on my master composer.json
also, the tertiary requirement can not resolve packagist libraries
Your requirements could not be resolved to an installable set of packages.
Problem 1
- ethereal/simpleCache dev-master requires predis/predis ^1.1#dev -> no matching package found.
- ethereal/simpleCache dev-master requires predis/predis ^1.1#dev -> no matching package found.
- Installation request for ethereal/simplecache dev-master -> satisfiable by ethereal/simpleCache[dev-master].
Main Project composer.json:
{
"name": "ethereal/SimpleTable",
"type": "project",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mathus13/SimpleConfig.git"
}
],
"require": {
"php": ">=5.3.9",
"doctrine/dbal": "^2.6#dev",
"ethereal/SimpleConfig": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"autoload": {
"psr-4": {
"Ethereal\\": "lib"
}
}
}
config library: when running composer update in SimpleTable, Simple Cache will not be included unless explicitly required in SimpleTable.
{
"name": "ethereal/SimpleConfig",
"type": "project",
"version": "0.0.1",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mathus13/SimpleCache.git"
}
],
"require": {
"php": ">=5.3.9",
"ethereal/SimpleCache": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"autoload": {
"psr-4": {
"Ethereal\\": "lib"
}
}
}
cache library: when running composer update in SimpleTable, predis can not be resolved.
{
"name": "ethereal/simpleCache",
"type": "project",
"version": "0.0.1",
"require": {
"predis/predis": "^1.1#dev",
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"autoload": {
"psr-4": {
"Ethereal\\": "lib"
}
}
}
ethereal/SimpleTable depends on ethereal/SimpleConfig in dev stability, which depends on ethereal/SimpleCache in dev stability, which depends on predis/predis in dev stability (version 1.1 hasn't been released yet).
Packages included into the main package cannot define any stability, the only stability allowed is the one in the main package. And that is "stable" by default.
You made ONE exception from this rule by depending on "dev-master" for SimpleConfig", but this is not inherited.
You have multiple solutions:
Tag your software. Tags declare it more stable than "dev", and it generally is a good idea to only use tagged software in production.
Include ALL your own packages that are needed in the main package, even if they are not directly used. This will add exceptions from the general stability for them, and allow Composer to resolve any sub dependencies.
You can add "minimum-stability":"dev" to the main composer.json, but this will also allow all other packages to be installed from a branch. Using branches however is a very bad thing, because you cannot easily go back to the version that was working before you did the update - the branch pointer moves only forward. Only tags will point to the same software forever.
Adding "prefer-stable":true" is some sort of workaround for the problem that 3 introduces for packages that are already available in a stable release version. However you still have the problem of not being able to go back to your own packages' earlier versions, because you are using a branch.
If you are still developing these packages, depending on branches may seem necessary. However, a good package will be able to be developed and tested standalone, with barely any foreign code present apart from interface definitions (which will be used to mock everything), so putting all code together into a mixture of repos with branches checked out usually is an invitation for writing code that isn't cleanly separated.
If any of these packages is already done (I'd say "good enough"), tag it and depend on that version instead of a branch. You can always release new versions if you find bugs or want to add new features.

Laravel 4 Installing dompdf

How do I install Laravel DomPDF?
I updated my Laravel's composer.json from this:
"require": {
"laravel/framework": "4.2.*",
"maatwebsite/excel": " ~1.2.1"
},
To this:
"require": {
"laravel/framework": "4.2.*",
"maatwebsite/excel": " ~1.2.1",
"barryvdh/laravel-dompdf": "0.5.*"
},
And then ran this command:
composer update barryvdh/laravel-dompdf": "0.5.*
But it always throws "don't install laravel 4.2" like that and the composer fails to update.
How can I fix this?
The very first line from the GitHub project page readme says:
DOMPDF Wrapper for Laravel 5
The second one states:
For Laravel 4.x, check the 0.4 branch!
Which means you need to add the 0.4.* version to you composer.json, for the package to work with Laravel 4:
"require": {
"laravel/framework": "4.2.*",
"maatwebsite/excel": " ~1.2.1",
"barryvdh/laravel-dompdf": "0.4.*"
},
change this line
"barryvdh/laravel-dompdf": "0.4"
you not use packege laravel 5 for laravel 4

Composer dependency constraint

Is there a possibility to let composer install a package only when the PHP version is below a given version.
https://github.com/ircmaxell/password_compat
"ircmaxell/password-compat": "dev-master"
I have found this package to be useful because I have a webserver which runs on PHP 5.4 and I need the password_* functions which are only available >= PHP 5.5.
Yes, there is. You can find the details on the packagist website, but basically, the package/dependency should be defined with this requirement:
{
"name": "ircmaxell/password-compat",
"description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash",
"require": {
"php": "<5.5.*",
"phpunit/phpunit": "4.*"
}
}
As you can see, I've added "php": "<5.5.*" to the requirements for the package. You can add this requirement to your own composer.json file, by adding the dependency to your repositories array in the composer.json file, and add the requirements there:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ircmaxell/password_compat",
"require": {
"php": "<5.5.*",
}
}]
}
Something like that, I only have php5.5 installed, so I was unable to test this, though... but read through the documentation, I'm pretty sure it's possible.

Zend Framework Composer Packages

I would like to add dependency to zendframework/zend-db package, so I added it to my composer.json:
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"php": ">=5.3.2",
"symfony/class-loader": "dev-master",
"symfony/console": "dev-master",
"symfony/filesystem": "dev-master",
"symfony/finder": "dev-master",
"symfony/locale": "dev-master",
"symfony/yaml": "dev-master",
"doctrine/dbal": "dev-master",
"zendframework/zend-db": "dev-master"
}
The problem is that composer installs entire zendframework/zendframework package.
Any idea why?
as explained here http://packages.zendframework.com/#composer ZF2 now provide a composer repository with all modules.
to add the repo to you package:
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
and from here on you can add packages seperately:
"require": {
"zendframework/zend-config": "2.0.*",
"zendframework/zend-http": "2.0.*"
},
you only need to specify the packages you want, if they have dependencies they will be resolved by compser.
allthough this does not seem to work atm...
Here's the composer.json from zend-db in the zend github. According to the file, zend-db does not have any dependencies.
This can be due to the fact that you're trying to download a package from dev-master and there's a missmatch in the composer.json of the dev-master.
I would suggest you to change the required version to something like 2.0.* and try again.
Also, Although Zend Framework is loosely coupled, in the older versions of the framework the dependencies were not explicit.
For instance, with a quick sweep over the source code of zend_db from ZEND 1.9, I found that it depends, at least, on the following packages:
Controller
Config
Filter
Json
Loader (for autoloading, I reckon this might not be necessary due to composer autoloader)
Uri
View
Wildfire
These packages might have other dependencies, hence the download size. Regardless, as King explained, Zend Framework 2.0 is different from version 1.9 and maybe this is not applicable to 2.0
Try to check if some packages have some php extensions in their dependencies. I have tried to install zend-http packages and have the same issue. Here I've found suggestion to install php_intl extension because it is required by zend-validate - subdependancy of the zend-http package. Once I've added this extension to the php.ini - problem was solved.

Categories