I have just started to explore ZF2 framework for my project. Please note that I have not worked with ZF1 framework also.
Problem:
I want to know the way/method/steps to install a stable version Zend framework 2.2.0.
Things Done:
I am able to install ZEND skeleton application by following the documentation PDF i.e. from GitHub however I am not able to locate the steps to download zend stable version from site and use it on local. This has downloaded framework is showing version >2.2.0 RC1.
I am not very much sure about how much it is stable since zend framework itself stated it as release candidate.
I have used the steps described in PDF document with downloaded zend framework however after executing composer update and install there were no public directory got installed in root directory.
Please let me know if there is any steps to use stable version of Zend Framework using which I can build my application OR I must have to use 2.2.0 RC1 provided by zend skeleton application from Github.
Thanks in Advance.
try this composer.json
{
"name": "zendframework/zendframework",
"description": "Zend Framework 2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"minimum-stability": "dev",
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "dev-master",
"zendframework/zend-developer-tools": "dev-master",
"doctrine/annotations": ">=1.0",
"ircmaxell/random-lib": "dev-master",
"ircmaxell/security-lib": "dev-master",
"ocramius/proxy-manager": "0.3.*",
"phpunit/PHPUnit": "3.7.*"
},
"autoload": {
"psr-0": {
"Zend\\": "library/",
"ZendTest\\": "tests/"
}
}
}
I prefer to use some stable libraries like:
"zendframework/zendframework": "2.1.5",
Related
I'm currently developing an app in Laravel and deploying it in Heroku.
I get this error when pushing:
symfony / polyfill-ctype v1.24.0 requires php >= 7.1
Anyone knows how to solve this?
The truth is that I investigated but I couldn't think of what to do. I already tried running composer update and there is no solution either.
Im using Laravel Framework 8.78.1
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.40",
"laravel/passport": "^10.2",
"laravel/tinker": "^2.5"
},
Add the following to the require section of your composer.json file:
"symfony/polyfill-ctype": "~1.23.0",
"symfony/polyfill-iconv": "~1.23.0",
"symfony/polyfill-mbstring": "~1.23.1",
"symfony/polyfill-php80": "~1.23.1"
From Heroku support:
"As symfony/polyfill-ctype declares ext-ctype as provided since v1.24.0 and this package is already bundled with the PHP package that Heroku provides, this leads to a conflict due to how Composer 1 resolves dependencies."
The 1.23 packages don't have this issue. Don't update to 1.24 until Heroku supports composer v2.
UPDATE Jan. 7, 2022: Heroku has hotfixed the issue. Declaring specific package versions should not be necessary. https://github.com/heroku/heroku-buildpack-php/issues/528
I am using Laravel 5.2.23 and am unable to pull in my new package, bsapaka/metattribute. I get the exception:
[InvalidArgumentException]
Could not find package bsapaka/metattribute at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
Composer seems to have it:
Running composer show bsapaka/metattribute returns:
name : bsapaka/metattribute
descrip. : classes for Laravel attributes
keywords : attribute, attributes, properties, alias, meta attribute
versions : dev-master
type : library
(more)
So I am wondering if I am missing something in the composer.json:
{
"name": "bsapaka/metattribute",
"type": "library",
"description": "classes for Laravel attributes",
"keywords": [
"attribute",
"attributes",
"properties",
"meta attribute",
"alias"
],
"homepage": "https://github.com/bsapaka/metattribute",
"license": "MIT",
"require": {
"illuminate/support": "~5.1",
"php" : "~5.5|~7.0"
},
"require-dev": {
"phpspec/phpspec": "~2.2"
},
"autoload": {
"psr-4": {
"bsapaka\\metattribute\\": "src/"
}
},
"minimum-stability": "stable"
}
I have done a good bit of docs reading, troubleshooting, adding in mininum-stability, checking the versioning, comparing against other packages, validating JSON, looking for the tidbits I missed etc, and at this point I could really use some guidance on where I might be going wrong. Thanks for reading, and I appreciate your help.
You don't have any version tag defined in your master branch on GitHub.
If there is no version tag then Composer doesn't know which version is the stable one. So if you have "minimum-stability": "stable" in the project which is requiring your self made package it can't find any stable version.
Create a new tag (e.g. 1.0.0) in your master branch on GitHub to declare the latest commit as stable or use the dev-master version and "minimum-stability": "dev" in the project which is requiring your self made package.
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.
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.
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.