I need to install Zend_XmlRpc module into my Symfony 2.1 application.
I tried the obvious way using composer.json dependencies:
"require": {
...
"zendframework/zend-xmlrpc": "dev-master"
},
I got the following problems:
- Installation request for zendframework/zend-xmlrpc dev-master -> satisfiable by zendframework/zend-xmlrpc dev-master.
- zendframework/zend-xmlrpc dev-master requires zendframework/zend-http dev-master -> no matching package found.
I'have added the package requirements from the https://packagist.org/packages/zendframework/zend-xmlrpc
"zendframework/zend-http": "dev-master",
"zendframework/zend-math": "dev-master",
"zendframework/zend-server": "dev-master",
"zendframework/zend-stdlib": "dev-master",
"zendframework/zend-xmlrpc": "dev-master"
But now I've got more problems as each of this package has it's own requirements.
My issue is that I have browsed all these requirements and in the end I am ending with installing the "whole" framework.
I get the http package, the loader package, event manager, which I am pretty sure symfony already got them.
Isn't there a way to integrate only the XMLRPC package and maybe bridge the functioanlity with the already existing one from Symfony components?
And if there isn't any solution, how can I force composer to auto install recursively all the required dependencies, as there are many of them, and is weird work to add them manually.
I don't see any reason for use the unstable version of the package.
Instead add
"require": {
...
"zendframework/zend-xmlrpc": "2.1.*"
},
Related
I found the composer.json & composer.lock(php) has conflict section (not to be confused with merge conflict ). The other similar files like package.json/yarn.json (nodejs) or Pipfile (python) and the corresponding lock files package-lock.json/yarn.lock or Pipfile.lock, do not have such format even though all these lock files serve the same purpose (lock the dependence to the exact version) and implement in the similar way (at least looking from the surface)
So what is usage of it and what should I do with it ? I read the composer document https://getcomposer.org/doc/04-schema.md#conflict but I still feel confused, e.g.
Map of packages that conflict with this version of this package. They will not be allowed to be installed together with your package.
For example after running composer install I have a composer.lock saying
{
"name": "symfony/http-kernel",
"version": "v4.4.20",
...
"conflict": {
"symfony/browser-kit": "<4.3",
"symfony/config": "<3.4",
"symfony/console": ">=5",
"symfony/dependency-injection": "<4.3",
"symfony/translation": "<4.2",
"twig/twig": "<1.43|<2.13,>=2"
},
...
It is easy to guess "symfony/console" 5.0 is conflicted with "symfony/http-kernel" 4.4.20 so symfony/console 5.0 will not be installed.
Do I need to do anything with the conflict ? So far I feel like that as a package user (not the package developer) those info is just a FYI and I don't need to do anything. But then why bother to list them for me ? After all package.json and Pipefile don't have such information and I don't find the problem without it.
--- update ---
From the answer I got I realize I need to emphasize this: I understand composer.lock is for composer so I don't need to worry about it.
What I don't understand is the purpose putting it in composer.json, this file is for human users. So if it has a conflict section what should I do about it?
I want to know a practical use case of "conflict" section in my composer.json if I am not a package developer but a package user.
When building an application, you are free to choose your dependencies way better than when you are building a reusable library like symfony/http-kernel which you've mentioned in your question.
Putting any other package constraint in the conflict section of such a package means: if you want to install the package in the current version, no other package version must be installed that is listed in the conflict section. From your example: symfony/http-kernel in v4.4.20 must not be installed if symfony/browser-kit is installed in any version <4.3.
In your own application, you have more freedom to use stricter constraints for the packages you use. You could require all packages with pretty strict version numbers, but this makes updates less comfortable. For example, this is a part of the require section in one of my current projects:
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.2",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"easycorp/easyadmin-bundle": "^3.1",
"exercise/htmlpurifier-bundle": "^3.1",
"knplabs/knp-snappy-bundle": "^1.8",
"league/csv": "^9.6",
"lexik/jwt-authentication-bundle": "^2.10",
"nelmio/cors-bundle": "^2.1",
All these packages might install tons of other dependencies which I cannot control. But if I know that any version of the other dependencies causes trouble, I can list them in the conflict section of my application such that this version is not installed.
For example, in the past I've needed that for an update of doctrine/migrations where the configuration has changed. I wanted to be able to update all packages except this one, because I didn't want to bother with the configuration changes I had to apply to my application for a while.
"conflict": {
"symfony/console": ">=5",
this means that for some reason your package can't work with symfony/console version 5 and higher, so it will keep it below 5.
E.g. you can exclude some package faulty version:
"conflict": {
"foo/bar": "1.420.69",
}
I know this is an old post, but thought I'd add a point to what's already been said:
You may still benefit from a conflict section in composer.json if you know any of your code conflicts with any packages. It could be any reason from both your code and the package trying to do similar jobs and stepping on each other's toes or simply that a package is badly written and breaks your code.
In that case, you can add a conflict section in your composer.json to tell composer to never download that package (or some releases of it).
This would be useful if you work with other developers and someone else might try to require that package, or if you worry that composer may try to install it as a dependency of yet another package e.g. X is the package you don't want, but another package Y depends on X and you don't know. Without the conflict section, composer would download package X without you even knowing/noticing.
I have a Symfony 4 project and am trying to install this package for working with AWS DynamoDB.
When I run composer require oasis/dynamodb-odm I get an error saying oasis/dynamodb-odm v0.5.3 requires symfony/console ^3.2 -> no matching package found. Attempting to run composer require symfony/console:^3.2 also results in the "Could not find package..." error.
As I am using Symfony 4, composer commands are intercepted by Symfony Flex and some extra stuff happens. Interestingly, there is a Flex recipe for symfony/console:3.3 but not 3.2 which I imagine might be the problem.
My understanding of the caret is that it should allow minor version bumps, so I wonder why console v3.3 is not installed instead.
I would like to use this package, and there aren't many DynamoDB PHP offerings out there, so how can I resolve this issue?
if you checkout the composer.json file of the package, you can see the following
"require" : {
"php" : ">=5.6",
"doctrine/annotations": "^1.4",
"oasis/aws-wrappers" : "^2.10",
"oasis/logging" : "^1.0",
"doctrine/common" : "^2.7",
"symfony/console" : "^3.2",
"symfony/finder" : "^3.2"
},
meaning it is compatible with symfony3 only.
Probably you can fork the repo and try changing the version numbers and test it. If it works you can install it.
I have a running CakePHP 3 project on which I use Phinx migrations. This morning I just changed one migration file, didn't do a rollback, but instead I dropped all tables and hoped that it will just re-run the migrations as before. So when I issue these commands:
bin/cake migrations migrate
bin/cake migrations rollback
bin/cake migrations status
Or whatever related to migrations, I get the following exception thrown in the CLI:
Exception: Argument 2 passed to Phinx\Migration\Manager::__construct() must
implement interface Symfony\Component\Console\Input\InputInterface, instance of
Symfony\Component\Console\Output\ConsoleOutput given, called in
/var/www/html/vendor/cakephp/migrations/src/ConfigurationTrait.php on line 191
in [/var/www/html/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php, line 89]
I have tried re-running composer update / install even dump-autoload, but nothing changed.
I do not know where to start debugging this.
One thing worth mentioning is that I use a custom error handler, for both the CLI and the web interaface. Respectivelly both of my custom error handlers extend their appopriate classes: \Cake\Console\ConsoleErrorHandler and \Cake\Error\ErrorHandler.
When I run composer info I get this output:
ajgl/breakpoint-twig-extension 0.3.1 Twig extension to set breakpoints
aptoma/twig-markdown 2.0.0 Twig extension to work with Markdown content
asm89/twig-cache-extension 1.3.2 Cache fragments of templates directly within Twig.
aura/intl 3.0.0 The Aura Intl package provides internationalization tools, specifically message trans...
cakephp/bake 1.7.2 Bake plugin for CakePHP 3
cakephp/cakephp 3.6.1 The CakePHP framework
cakephp/cakephp-codesniffer 3.0.3 CakePHP CodeSniffer Standards
cakephp/chronos 1.1.4 A simple API extension for DateTime.
cakephp/debug_kit 3.15.2 CakePHP Debug Kit
cakephp/migrations 1.3 Database Migration plugin for CakePHP 3.0 based on Phinx
cakephp/plugin-installer 1.1.0 A composer installer for CakePHP 3.0+ plugins.
composer/ca-bundle 1.1.1 Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla ...
composer/composer 1.6.4 Composer helps you declare, manage and install dependencies of PHP projects, ensuring...
composer/semver 1.4.2 Semver library that offers utilities, version constraint parsing and validation.
composer/spdx-licenses 1.3.0 SPDX licenses list and validation library.
crabstudio/recaptcha 2.1.0 Easily use Google Recaptcha in CakePHP 3.2+ projects
dnoegel/php-xdg-base-dir 0.1 implementation of xdg base directory specification for php
florianwolters/component-core-stringutils v0.3.1 Offers operations on the data type string as a PHP component.
florianwolters/component-util-reflection v0.2.0 Provides operations for the PHP Reflection API as a PHP component.
florianwolters/component-util-singleton v0.3.2 The Singleton (and Registry of Singletons a.k.a. Multiton) design pattern as a PHP co...
guzzlehttp/guzzle 6.3.3 Guzzle is a PHP HTTP client library
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.4.2 PSR-7 message implementation that also provides common utility methods
jakub-onderka/php-console-color 0.1
jakub-onderka/php-console-highlighter v0.3.2
jasny/twig-extensions v1.2.0 A set of useful Twig filters
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
josegonzalez/dotenv 2.1.0 dotenv file parsing for PHP
justinrainbow/json-schema 5.2.7 A library to validate a json schema.
m1/env 2.1.0 Env is a lightweight library bringing .env file parser compatibility to PHP. In short...
mnsami/composer-custom-directory-installer 1.1.1 A composer plugin, to help install packages of different types in custom paths.
mobiledetect/mobiledetectlib 2.8.31 Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the Us...
nikic/php-parser v4.0.1 A PHP parser written in PHP
predis/predis v1.1.1 Flexible and feature-complete Redis client for PHP and HHVM
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.0.2 Common interface for logging libraries
psy/psysh v0.9.3 An interactive shell for modern PHP.
robmorgan/phinx 0.9.2 Phinx makes it ridiculously easy to manage the database migrations for your PHP app.
seld/cli-prompt 1.0.3 Allows you to prompt for user input on the command line, and optionally hide the char...
seld/jsonlint 1.7.1 JSON Linter
seld/phar-utils 1.0.1 PHAR file format utilities, for when PHP phars you up
squizlabs/php_codesniffer 3.2.3 PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a d...
symfony/config v4.0.8 Symfony Config Component
symfony/console v4.0.8 Symfony Console Component
symfony/filesystem v4.0.8 Symfony Filesystem Component
symfony/finder v4.0.8 Symfony Finder Component
symfony/polyfill-mbstring v1.7.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.7.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/process v4.0.8 Symfony Process Component
symfony/var-dumper v4.0.8 Symfony mechanism for exploring and dumping PHP variables
symfony/yaml v4.0.8 Symfony Yaml Component
twig/twig v1.35.3 Twig, the flexible, fast, and secure template language for PHP
umpirsky/twig-php-function v0.1 Call (almost) any PHP function from your Twig templates.
wyrihaximus/twig-view 4.3.4 Twig powered View for CakePHP3
zendframework/zend-diactoros 1.7.1 PSR HTTP Message implementations
And the contents of composer.json file are as:
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "https://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.6",
"cakephp/cakephp": "^3.5",
"cakephp/migrations": "^1.8",
"cakephp/plugin-installer": "^1.0",
"crabstudio/recaptcha": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"josegonzalez/dotenv": "2.*",
"mobiledetect/mobiledetectlib": "2.*"
},
"require-dev": {
"cakephp/bake": "^1.1",
"cakephp/cakephp-codesniffer": "^3.0",
"cakephp/debug_kit": "^3.2",
"psy/psysh": "#stable"
},
"suggest": {
"markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
"dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan compatibility.",
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests/",
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump",
"check": [
"#test",
"#cs-check"
],
"cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"test": "phpunit --colors=always"
},
"prefer-stable": true,
"config": {
"sort-packages": true
}
}
It looks like your composer packages got out of sync.
To force a refresh delete the vendor folder also delete composer.lock and then run
composer install
It will download everything again, rebuild your vendor and make sure Phinx and Symphony are in sync again.
After you do this, you run your migrations again and see what happens.
This statement of yours
"I dropped all tables and hoped that it will just re-run the migrations as before."
worries me a bit, because the Phinx migration manger keeps its log in the database in a table called phinxlog (sometimes prefixed with a plugin name if you're talking about a plugin). If you deleted that then phix does not know what migrations did you run already and which ones are new. To fix this you may need to mark some of the earlier migrations are migrated so phinx does not attempt to do things that were already done.
What do I add in my Composer.json file so it downloads version 2.3.5 of the Zend Framework? I've tried reading the Zend docs but it doesn't mention Composer.
{
"require" : {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7",
"aws/aws-sdk-php": "~2.6",
"zendframework/zendservice-amazon": "2.3.5"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
}
]
}
After I run composer update, it gives me this error message:
C:\Users\Ricky\graffiti-galore>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package zendframework/zendservice-amazon could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.
Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
In your require statement, it looks like you're using the wrong include for Zend. In your require statement:
"zendframework/zendservice-amazon": "2.3.5"
should be
"zendframework/zend-config": "2.3.5",
"zendframework/zend-http": "2.3.5"
Or if you want to avoid requiring a specific version number,
"zendframework/zend-config": "2.*",
"zendframework/zend-http": "2.*"
and for the part in minimum stability
"minimum-stability": "dev"
zendservice-amazon is not part of Zend Framework 2, none of the ZendService libs are. Its latest version is 2.0.3, all versions are listed here: https://packagist.org/packages/zendframework/zendservice-amazon
There is no version 2.3.5 for zendframework/zendservice-amazon, so obviously the install fails. Look at https://packagist.org/packages/zendframework/zendservice-amazon to see the available versions and fix the version selector (I'd suggest ~2.0).
You also don't need the repositories part in your composer.json, all the packages are also on Packagist, Composer's main and default package repository.
I downloaded and setup an Sonata's Sonata-Sandbox Bundle for Symfony2. I'm using Symfony 2.2.2. It's a good package and contains mostly used packages installed.
After installation I decided not to use SonataPageBundle that's included in package because it overrides all my Bundle's but unable to remove it.
I tried to remove it from composer.json and tried a php composer.phar update but no luck, update is always failing because of the dependency other libraries.
Actually, I need SonataAdminBundle with Media library on any version of Symfony 2.x. I found other solutions to install Symfony 2 + SonataAdminBundle + etc but they are also failing on different version support in composer.json and could't make a successful installation manually.
I'm on Mac 10.8 and BitNapi MAMP Stack 5.4.15-0 with PHP 5.3
Are there any better ways to install these extensions to Symfony 2?
Yes, you can use composer to install only the Sonata bundles you need. Here's mine, which is about as short as it gets for Sonata using Doctrine:
"require": {
"sonata-project/admin-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/user-bundle": "dev-master",
"sonata-project/media-bundle": "dev-master"
}
If you haven't actually started coding anything, you might want to start a new project because removing PageBundle is slightly tedious and reinstalling using this guide is simple and basically three simple steps:
Install composer:
curl -s https://getcomposer.org/installer | php
Download Symfony2:
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.3.0
Then you can add the bundles you need in composer.json and run
php composer.phar update