Recently I unignored composer.lock along with package-lock.json (likely unrelated), and I changed our gulp deploy script to use composer install instead of composer update. Before pushing new code to prod servers I updated the lock files to the latest using composer update and npm update to make sure there was nothing weird in there from branch merges.
However the gulp deployment script hit various issues, the most problematic of which was: "Requirements could not be resolved to an installable set of packages"
gulp-tasks/deploy.js in its current state:
var args = require('yargs').argv;
var exec = require('./helpers/exec');
var runSequence = require('run-sequence');
module.exports = function (gulp, plugins, settings) {
return function (completed) {
var jsBundle = [];
// Set production / staging only bundling options
settings.env === 'production' || settings.env === 'staging'
? jsBundle.push('js:bundle-production')
: jsBundle.push('js:bundle-vendor', 'js:bundle-vue', 'js:bundle-core');
if (!args.x) { // Exclude mode
console.log('Fetching latest commits from remote repository..');
exec('git fetch');
try {
console.log('Attempting to merge upstream branch into local..');
exec('git merge'); // If up-stream set on branch, merge it into local branch
} catch (e) {}
}
if (args.v) { // Checkout version tag
console.log('Checking out release tag..');
exec('git checkout tags/' + args.v);
}
if (args.s) { // Speed mode
console.log('Building JS and SASS..');
runSequence(
'make:htaccess',
'sass:compile',
'js:bundle-login',
jsBundle,
'copy-public',
'remove:config',
completed
);
} else if (args.b) {
runSequence(
'make:htaccess',
'remove:config',
completed
);
} else {
// Full deploy
// Create array for additional tasks we can pipe things like bugsnag into (this can't be empty)
var extraTasks = ['remove:config'];
if (settings.env === settings.production) {
extraTasks.push('bugsnag'); // Add Bugsnag source maps on production
}
console.log('Installing composer packages..');
exec('composer install');
console.log('Installing NPM packages & pruning old packages..');
exec('npm prune');
// If deploying to a version then we don't want any potential package or package.lock changes saved
if (args.v) {
exec('npm install --no-save');
} else {
exec('npm install');
}
runSequence(
'make:htaccess',
'sass:compile',
'js:bundle-login',
jsBundle,
'copy-public',
extraTasks,
completed
);
}
if (args.u) {
console.log('Running unit tests..');
try {
exec('./vendor/bin/phpunit --bootstrap tests/unit/bootstrap.php -c tests/unit/phpunit.xml tests/unit');
} catch (e) {}
}
if (args.y) {
try {
console.log('Updating system packages..');
exec('[ -n "$(which yum)" ]');
exec('sudo yum -y update');
} catch (e) {
console.log('yum not found.');
}
}
}
};
composer.json:
{
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "git",
"url": "https://company/repo/iputils.git"
},
{
"type": "git",
"url": "https://company/repo/phpwhois.git"
}
],
"autoload": {
"psr-4": {"company\\Database\\": "database/src"}
},
"require": {
"php": ">=7.1",
"ext-dom": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"ext-SimpleXML": "*",
"adobe-marketing-cloud/marketing-cloud-php-sdk": "2.1.x",
"atrapalo/majesticseo-php-api-connector": "0.9.*",
"aveiv/open-exchange-rates-api": "1.1",
"aws/aws-sdk-php": "3.*",
"bshaffer/oauth2-server-php": "1.10",
"bugsnag/bugsnag": "^3.0",
"diggin/diggin-http-charset": "dev-master",
"eloquent/enumeration": "5.*",
"google/apiclient": "2.1.*",
"guzzlehttp/guzzle": "6.*",
"h4cc/wkhtmltopdf-amd64": "0.12.x",
"h4cc/wkhtmltoimage-amd64": "0.12.x",
"intervention/image": "^2.3",
"knplabs/knp-snappy": "^0.4.3",
"kunststube/rison": "0.92",
"league/csv": "^9.0",
"pelago/emogrifier": "#dev",
"php-di/php-di": "6.0.x",
"companyrepo/iputils": "dev-master",
"companyrepo/phpwhois": "dev-4-stable",
"ramsey/uuid": "2.8.*",
"shazam/php-slack": "^0.1.0",
"sameer-shelavale/php-countries-array": "*",
"symfony/intl": "^3.1",
"zendframework/zendframework1": "1.*",
"zendframework/zendframework": "3.*",
"zendframework/zend-http": "2.7.0",
"johnpbloch/wordpress-core-installer": "^1.0",
"johnpbloch/wordpress-core": "4.9.*",
"wpackagist-plugin/advanced-text-widget": "2.0.*",
"wpackagist-plugin/drafts-of-post-revisions": "0.8.*",
"wpackagist-plugin/image-widget": "4.2.*",
"wpackagist-plugin/inline-google-spreadsheet-viewer": "0.10.*",
"wpackagist-plugin/posts-to-posts": "1.6.*",
"wpackagist-plugin/post-types-order": "1.8.*",
"wpackagist-plugin/simple-page-ordering": "2.2.*",
"wpackagist-plugin/wp-migrate-db": "0.*",
"wpackagist-plugin/wp-cerber": "6.*",
"zircote/swagger-php": "dev-master",
"simshaun/recurr": "3.0.5",
"robmorgan/phinx": "*",
"fzaninotto/faker": "*"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "6.*",
"phploc/phploc": "*",
"phpmd/phpmd": "*",
"slevomat/coding-standard": "~4.0",
"squizlabs/php_codesniffer": "3.*"
},
"extra": {
"wordpress-install-dir": "public/support/wp",
"installer-paths": {
"public/support/support-content/plugins/{$name}/": ["type:wordpress-plugin"]
}
}
}
Deploy command we run on production servers: gulp deploy -v tagversionnumber
Composer diagnose example from one of the prod servers:
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.aveiv/open-exchange-rates-api : exact version constraints (1.1) should be avoided if the package follows semantic versioning
require.bshaffer/oauth2-server-php : exact version constraints (1.10) should be avoided if the package follows semantic versioning
require.diggin/diggin-http-charset : unbound version constraints (dev-master) should be avoided
require.pelago/emogrifier : unbound version constraints (#dev) should be avoided
require.companyrepo/iputils : unbound version constraints (dev-master) should be avoided
require.sameer-shelavale/php-countries-array : unbound version constraints (*) should be avoided
require.zendframework/zend-http : exact version constraints (2.7.0) should be avoided if the package follows semantic versioning
require.zircote/swagger-php : unbound version constraints (dev-master) should be avoided
require.simshaun/recurr : exact version constraints (3.0.5) should be avoided if the package follows semantic versioning
require.robmorgan/phinx : unbound version constraints (*) should be avoided
require.fzaninotto/faker : unbound version constraints (*) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: WARNING
You are not running the latest stable version, run `composer self-update` to update (1.3.0 => 1.7.2)
Some servers are running composer 1.2.2
On the same prod server composer install --dry-run:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for zendframework/zend-soap 2.7.0 -> satisfiable by zendframework/zend-soap[2.7.0].
- zendframework/zend-soap 2.7.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.
Problem 2
- zendframework/zendframework 3.0.0 requires zendframework/zend-soap ^2.6 -> satisfiable by zendframework/zend-soap[2.7.0].
- zendframework/zendframework 3.0.0 requires zendframework/zend-soap ^2.6 -> satisfiable by zendframework/zend-soap[2.7.0].
- zendframework/zend-soap 2.7.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.
- Installation request for zendframework/zendframework 3.0.0 -> satisfiable by zendframework/zendframework[3.0.0].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
- /etc/php-7.1.d/10-opcache.ini
- /etc/php-7.1.d/20-bz2.ini
- /etc/php-7.1.d/20-calendar.ini
- /etc/php-7.1.d/20-ctype.ini
- /etc/php-7.1.d/20-curl.ini
- /etc/php-7.1.d/20-dom.ini
- /etc/php-7.1.d/20-exif.ini
- /etc/php-7.1.d/20-fileinfo.ini
- /etc/php-7.1.d/20-ftp.ini
- /etc/php-7.1.d/20-gd.ini
- /etc/php-7.1.d/20-gettext.ini
- /etc/php-7.1.d/20-iconv.ini
- /etc/php-7.1.d/20-imap.ini
- /etc/php-7.1.d/20-json.ini
- /etc/php-7.1.d/20-mbstring.ini
- /etc/php-7.1.d/20-mysqlnd.ini
- /etc/php-7.1.d/20-pdo.ini
- /etc/php-7.1.d/20-phar.ini
- /etc/php-7.1.d/20-posix.ini
- /etc/php-7.1.d/20-shmop.ini
- /etc/php-7.1.d/20-simplexml.ini
- /etc/php-7.1.d/20-sockets.ini
- /etc/php-7.1.d/20-sqlite3.ini
- /etc/php-7.1.d/20-sysvmsg.ini
- /etc/php-7.1.d/20-sysvsem.ini
- /etc/php-7.1.d/20-sysvshm.ini
- /etc/php-7.1.d/20-tokenizer.ini
- /etc/php-7.1.d/20-xml.ini
- /etc/php-7.1.d/20-xmlwriter.ini
- /etc/php-7.1.d/20-xsl.ini
- /etc/php-7.1.d/20-zip.ini
- /etc/php-7.1.d/30-mysqli.ini
- /etc/php-7.1.d/30-pdo_mysql.ini
- /etc/php-7.1.d/30-pdo_sqlite.ini
- /etc/php-7.1.d/30-wddx.ini
- /etc/php-7.1.d/30-xmlreader.ini
- /etc/php-7.1.d/40-apcu.ini
- /etc/php-7.1.d/php.ini
Note ext-soap is not on our local environments either, but install works fine there. And composer update works fine on both prod and local
You should install and enable php-soap extension.
zendframework/zend-soap 2.7.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.
On my computer Ubuntu, I use composer for :
local-installing packages into my project
global-installing librairies for my bash usage (phpunit, phpcs, phpmd for example)
In my project, I have a myproject/composer.json file with
"require": {
"php": ">=5.5.9",
"sensio/framework-extra-bundle": "^3.0.2",
"lib-curl": ">=7",
"ext-curl": ">=7"
},
"require-dev": {
"phpunit/phpunit": ">=6"
}
In my global ~/.composer/composer.json I already have
"require": {
"phpunit/phpunit": ">=6"
}
Is there a mean to specify in my project that the phpunit is already installed on global and having :
myproject/vendor/bin/phpunit as symnlink toward ~/.composer/vendor/bin/phpunit
myproject/vendor/autoload.php including the classes of ~/.composer/vendor/phpunit ?
I am trying to setting up Codeception with Yii2 Basic framework. Unit Test's are working fine. Acceptance is also working, but if I want to use WebDriver module, I get error. This is the acceptance.suite.yml file
class_name: AcceptanceTester
modules:
enabled:
- AcceptanceHelper
- WebDriver:
url: 'http://mylocalsite'
browser: phantomjs
Phantomjs is installed and running on PORT 4444.
The error I get is:
[yii\base\ErrorException]
Illegal offset type in isset or empty
This is the composer file to give you idea about versions.
{
"config": {
"vendor-dir": "protected/vendor"
},
"require": {
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"guzzlehttp/guzzle": "4.*",
"mobiledetect/mobiledetectlib" : "2.8.8",
"codeception/codeception": "2.0.16",
"codeception/specify": "*",
"codeception/verify": "*",
"yii2tech/sitemap": "*",
"geoip2/geoip2":"~2.0",
"facebook/facebook-instant-articles-sdk-php": "^1.5"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-composer": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
}
Is there any wrong with the configuration file or anyone face the same issue?
The following is just an assumption and is not verified. YAML configuration in old Codeception version was slightly different, AFAIK there was an additional config section. Your composer.json shows that you manually locked to "codeception/codeception": "2.0.16".
What you could try:
Update to 2.2
using "codeception/codeception": "^2.2" in composer.json
Provide additional config section
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
config:
WebDriver:
url: http://mylocalsite
browser: phantomjs
port: 4444
When I call bin/behat to execute my tests, I get this error:
test.dev bin/behat
[Zend_Db_Adapter_Exception]
SQLSTATE[HY000] [2002] No such file or directory
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
This is my composer.json:
{
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"magetest/magento-behat-extension": "dev-develop",
"magetest/magento-phpspec-extension": "~2.0",
"peridot-php/webdriver-manager": "dev-master",
"bossa/phpspec2-expect": "dev-master",
"behat/mink-extension": "*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium2-driver": "*",
"behat/mink-selenium-driver": "*"
},
"autoload": {
"psr-0": {
"": [
"html/app",
"html/app/code/community",
"html/app/code/core",
"html/lib"
],
"Mage" : "html/app/code/core"
}
},
"config": {
"bin-dir": "bin"
}
}
And this is my behat.yml:
default:
paths:
features: features
bootstrap: features/bootstrap
extensions:
MageTest\MagentoExtension\Extension: ~
Behat\MinkExtension\Extension:
base_url: http://test.dev
goutte: ~
selenium2: ~
default_session: selenium2
It's a patchwork of several tutorials while every of them threw the same error. My Magento installation is in html under project. Only thing that differs to all tutorials is, that I have no html/app/code/local folder.
Composer install and behat --init run without errors.
Edit:
I'm working with MAMP Pro, so I found this issue. But linking the socket file to /tmp did not fix my problem.
Since I use MAMP, I have to configure it for CLI as well:
export PATH=/Applications/MAMP/bin/php/php5.6.10/bin:$PATH
Now CLI uses my MAMP PHP version and everything runs well.
I'm having a lot of trouble with setting up behat + mink for my laravel project.
The error msg:
PHP Deprecated: The ability to pass file names to Yaml::parse() was deprecated in 2.7
and will be removed in 3.0. Please, pass the contents of the file instead. in
home/user/projects/php/projectname/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php
on line 58
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
`Behat\MinkExtensions\Extension` extension file or class could not be located.
My composer.json:
"require": {
"laravel/framework": "4.2.*",
"behat/behat": "~3.0.6",
"behat/mink": "1.6.*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium-driver": "*",
"behat/mink-selenium2-driver": "*",
"behat/mink-sahi-driver": "*",
"behat/mink-zombie-driver": "*"
My behat.yml (located in the root of the project)
default:
extensions:
Behat\MinkExtensions\Extension:
goutte: ~
I've tried different versions, but still same error msg.
The commands I've run are:
./vendor/bin/behat --init
./vendor/bin/behat
But produces same msg.
https://github.com/Behat/MinkExtension/blob/master/doc/index.rst
Reading the above solved the problem and the behat.yml should look like this.
# behat.yml
default:
# ...
extensions:
Behat\MinkExtension:
base_url: 'http://example.com'
sessions:
default:
goutte: ~