The {{ path }} function when used in JavaScript is not working in Symfony 4. Just some background:
$ bin/console debug:router
Produces:
add_post_comment ANY ANY ANY /comment/add/post
In my JavaScript file, here is what my AJAX call looks like:
$.ajax({
url: "{{ path('/comment/add/post') }}", // I also tried "{{ path('add_post_comment') }}"
type: "POST",
dataType: "json",
data: {
"userId": userId,
"postId": postId,
"commentText": commentText
},
async: true,
success: function (data)
{
alert("success!");
console.log(data)
$('div#ajax-results').html(data.output);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("error - " + errorThrown + " - textStatus is " + textStatus);
console.log("Error in saving comment to database: " + errorThrown);
console.log(errorThrown);
console.log("XMLHttpRequest is: ");
console.log(XMLHttpRequest);
}
});
Then when I debug everything in the JavaScript console, it produces:
http://------.-------.com/%7B%7B%20path('/comment/add/post')%20%7D%7D 404 (Not Found)
So the path command is not actually compiling.
Here is what my composer.json looks like:
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"aws/aws-sdk-php": "^3.67",
"aws/aws-sdk-php-symfony": "^2.0",
"doctrine/doctrine-fixtures-bundle": "^3.0",
"knplabs/knp-paginator-bundle": "^2.8",
"sensio/framework-extra-bundle": "^5.2",
"symfony/asset": "^4.1",
"symfony/console": "^4.1",
"symfony/event-dispatcher": "^4.1",
"symfony/expression-language": "^4.1",
"symfony/flex": "^1.0",
"symfony/form": "^4.1",
"symfony/framework-bundle": "^4.1",
"symfony/lts": "^4#dev",
"symfony/monolog-bundle": "^3.3",
"symfony/orm-pack": "^1.0",
"symfony/process": "^4.1",
"symfony/security-bundle": "^4.1",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.2",
"symfony/translation": "^4.1",
"symfony/twig-bundle": "^4.1",
"symfony/validator": "^4.1",
"symfony/web-link": "^4.1",
"symfony/yaml": "^4.1",
"twig/extensions": "^1.5"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/dotenv": "^4.1",
"symfony/maker-bundle": "^1.5",
"symfony/profiler-pack": "*",
"symfony/test-pack": "^1.0",
"symfony/web-server-bundle": "^4.1"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false
}
}
}
Any help is greatly appreciated.
Include your code inside another twig which you are sure of that it is rendered already as a twig. (like your base.html.twig or even better: only twig files that are actually going to need this piece of code)
The twig file located in SomeBundle in the folder Resources/views/Someotherfolder with name "myjavascript.html.twig" can look like this:
<script>
// Your javascript code here
var myvar = "{{ path('add_post_comment') }}";
</script>
This file you include inside another twig file
{% block javascripts %}
{% include 'SomeBundle:Someotherfolder:myjavascript.html.twig' %}
{% endblock %}
Or when your code in the file myjavascript.html.twig is without "script" tags like:
// Your javascript code here
var myvar = "{{ path('add_post_comment') }}";
You need to put it inside other script tags
{% block javascripts %}
<script>
{% include 'SomeBundle:Someotherfolder:myjavascript.html.twig' %}
</script>
{% endblock %}
Related
I'm a beginner in Symfony and would like to know how to deal with the following installation issue:
I'm using Symfony 4.4 and trying to install Swift Mailer. Following the documentation on this link, when I ran the following command composer require symfony/swiftmailer-bundle , I got this error message:
Your requirements could not be resolved to an installable set of
packages.
Problem 1
symfony/web-server-bundle is locked to version v4.4.0 and an update of this package was not requested.
symfony/web-server-bundle v4.4.0 requires php ^7.1.3 -> your php version (8.0.12) does not satisfy that requirement.
Problem 2
laminas/laminas-code 3.4.1 requires php ^7.1 -> your php version (8.0.12) does not satisfy that requirement.
symfony/proxy-manager-bridge v4.4.34 requires friendsofphp/proxy-manager-lts ^1.0.2 -> satisfiable by
friendsofphp/proxy-manager-lts[v1.0.5].
friendsofphp/proxy-manager-lts v1.0.5 requires laminas/laminas-code ~3.4.1|^4.0 -> satisfiable by laminas/laminas-code[3.4.1].
symfony/proxy-manager-bridge is locked to version v4.4.34 and an update of this package was not requested.
Any idea how to handle that?
Update:
This is my composer.json file:
{
"type": "project",
"license": "proprietary",
"require": {
"php": ">=7.4.3",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "1.11.99.4",
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.10",
"phpdocumentor/reflection-docblock": "^5.3",
"sensio/framework-extra-bundle": "^5.1",
"symfony/asset": "4.4.*",
"symfony/console": "4.4.*",
"symfony/dotenv": "4.4.*",
"symfony/expression-language": "4.4.*",
"symfony/flex": "^1.3.1",
"symfony/form": "4.4.*",
"symfony/framework-bundle": "4.4.*",
"symfony/http-client": "4.4.*",
"symfony/intl": "4.4.*",
"symfony/mailer": "4.4.*",
"symfony/monolog-bundle": "^3.1",
"symfony/process": "4.4.*",
"symfony/property-access": "4.4.*",
"symfony/property-info": "4.4.*",
"symfony/proxy-manager-bridge": "4.4.*",
"symfony/security-bundle": "4.4.*",
"symfony/serializer": "4.4.*",
"symfony/translation": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/validator": "4.4.*",
"symfony/web-link": "4.4.*",
"symfony/web-server-bundle": "4.4",
"symfony/yaml": "4.4.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "4.4.*",
"symfony/css-selector": "4.4.*",
"symfony/debug-bundle": "4.4.*",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^5.3",
"symfony/stopwatch": "4.4.*",
"symfony/web-profiler-bundle": "4.4.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
}
}
}
Try changing composer.json
From:
"symfony/web-server-bundle": "4.4",
To:
"symfony/web-server-bundle": "4.4.*",
Then try running:
composer update
In order to get the latest versions of the dependencies and to update the composer.lock file: https://getcomposer.org/doc/03-cli.md#update-u,
then:
composer require symfony/swiftmailer-bundle
I recommend that you change from swiftmailer to symfony mailer (https://symfony.com/doc/4.4/mailer.html) because swiftmailer has reached its eol:
https://symfony.com/blog/the-end-of-swiftmailer
While running the Pimcore6.9 along with the symfony4.4 I had spotted some warnings:
The MimetypeGuesser is depricated since symfony4.3 use MimeTypes
instead.
composer show -i
does not show any mime Package at all, so in order to get rid of this warnings I would like to install the package as proposed:
composer require symfony/mime
But I get this:
Using version ^5.2 for symfony/mime
./composer.json has been updated
Running composer update symfony/mime
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires symfony/mime ^5.2, found symfony/mime[v5.2.0, ..., v5.2.9] but these were not loaded, likely because it conflicts with another require.
composer.json
{
"name": "pimcore/skeleton",
"type": "project",
"license": "GPL-3.0-or-later",
"config": {
"optimize-autoloader": true,
"sort-packages": true
},
"require": {
"php": ">=7.2",
"pimcore/pimcore": "~6.9.0"
},
"require-dev": {
"cache/integration-tests": "^0.16.0",
"codeception/codeception": "~2.4.5"
},
"autoload": {
"psr-4": {
"": ["src/"],
"Pimcore\\Model\\DataObject\\": "var/classes/DataObject",
"Pimcore\\Model\\Object\\": "var/classes/Object",
"Website\\": "legacy/website/lib"
},
"classmap": [
"app/AppKernel.php"
]
},
"scripts": {
"post-create-project-cmd": "Pimcore\\Composer::postCreateProject",
"post-install-cmd": [
"Pimcore\\Composer::postInstall",
"#pimcore-scripts"
],
"post-update-cmd": [
"Pimcore\\Composer::postUpdate",
"#pimcore-scripts",
"Pimcore\\Composer::executeMigrationsUp",
"#pimcore-scripts"
],
"pimcore-scripts": [
"Pimcore\\Composer::clearCache",
"Pimcore\\Composer::installAssets"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative"
}
}
and within pimcore
{
"name": "pimcore/pimcore",
"type": "library",
"description": "Content & Product Management Framework (CMS/PIM/E-Commerce)",
"keywords": [
"CMS",
"PIM",
"DAM",
"E-Commerce",
"RAD",
"Product Information Management"
],
"homepage": "http://www.pimcore.org/",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "pimcore Team",
"email": "info#pimcore.com",
"homepage": "http://www.pimcore.org/",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/pimcore/pimcore/issues",
"wiki": "https://pimcore.com/docs/latest/",
"source": "https://github.com/pimcore/pimcore",
"forum": "https://talk.pimcore.org/",
"docs": "https://pimcore.com/docs/latest/"
},
"require": {
"php": ">=7.2",
"ext-SimpleXML": "*",
"ext-dom": "*",
"ext-exif": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-intl": "*",
"ext-iconv": "*",
"ext-mbstring": "*",
"ext-mysqli": "*",
"ext-pdo_mysql": "*",
"ext-zip": "*",
"ext-zlib": "*",
"psr/simple-cache": "^1.0.0",
"amnuts/opcache-gui": "^3.0.1",
"cache/tag-interop": "^1",
"cbschuld/browser.php": "^1.9.6",
"colinmollenhour/credis": "^1.10.0",
"composer/ca-bundle": "^1",
"defuse/php-encryption": "^2.2.0",
"doctrine/annotations": "^1.6.0",
"doctrine/collections": "^1.5.0",
"doctrine/common": "^2.13.0",
"doctrine/dbal": "^2.8.0",
"doctrine/doctrine-bundle": "^1.9.1",
"doctrine/doctrine-migrations-bundle": "^1.3.1",
"doctrine/inflector": "^1.4.0 || ^2.0.0",
"egulias/email-validator": "^2.1.5",
"endroid/qr-code": "^3.4.4",
"friendsofsymfony/jsrouting-bundle": "^2.5",
"geoip2/geoip2": "^2.9",
"google/apiclient": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"http-interop/http-factory-guzzle": "^1.0.0",
"hybridauth/hybridauth": "^2.12",
"lcobucci/jwt": "^3.2",
"league/csv": "^9.1",
"linfo/linfo": "^4.0.0",
"mjaschen/phpgeo": "^2.0",
"mpratt/embera": "^2.0.3",
"myclabs/deep-copy": "^1.3",
"neitanod/forceutf8": "^2.0.4",
"nesbot/carbon": "^1.34.0 || ^2.11.0",
"ocramius/package-versions": "^1.2",
"pear/net_url2": "^2.2",
"phive/twig-extensions-deferred": "^2.0",
"piwik/device-detector": "^3.9",
"presta/sitemap-bundle": "^1.7 || ^2.1",
"ramsey/uuid": "^3.8",
"sabre/dav": "^3.2",
"sensio/framework-extra-bundle": "^5.4",
"sensiolabs/ansi-to-html": "^1.1",
"symfony-cmf/routing-bundle": "^2.0",
"symfony/contracts": "^1.1",
"symfony/monolog-bundle": "^3.1.0",
"symfony/swiftmailer-bundle": "^3.2.2",
"symfony/symfony": "^3.4.26 || ^4.1.12",
"tijsverkoyen/css-to-inline-styles": "^2.2.1",
"twig/extensions": "^1.5",
"twig/twig": "^2.4",
"umpirsky/country-list": "^2.0.4",
"vrana/adminer": "^4.8.0",
"vrana/jush": "~2.0.2",
"zendframework/zend-paginator": "^2.7",
"zendframework/zend-servicemanager": "^3.2",
"scheb/two-factor-bundle": "^3.26",
"phpoffice/phpspreadsheet": "^1.9",
"html2text/html2text": "^4.2.1",
"webmozarts/console-parallelization": "^1.1.0",
"knplabs/knp-paginator-bundle": "^4.1.1"
},
"conflict": {
"doctrine/dbal": "^2.13.0",
"monolog/monolog": ">=2",
"phpstan/phpstan": "0.12.55",
"symfony/symfony": "3.4.43 || 4.4.11",
"symfony/monolog-bundle": "3.6.0"
},
"require-dev": {
"cache/integration-tests": "^0.16.0",
"codeception/codeception": "~2.4.5",
"phpstan/phpstan": "^0.12.26",
"phpstan/phpstan-symfony": "^0.12",
"heidelpay/heidelpay-php": "^1.2.5.1",
"klarna/checkout": "^3.0.0",
"elasticsearch/elasticsearch": "^6 || ^7",
"paypal/paypal-checkout-sdk": "^1",
"mpay24/mpay24-php": "^4.2",
"composer/composer": "*"
},
"suggest": {
"ext-curl": "*",
"ext-imagick": "*",
"ext-redis": "*",
"heidelpay/heidelpay-php": "Required for Heidelpay payment",
"klarna/checkout": "Required for Klarna payment",
"elasticsearch/elasticsearch": "Required for Elastic Search service",
"paypal/paypal-checkout-sdk": "Required for Paypal payment",
"mpay24/mpay24-php": "Required for MPay24 payment"
},
"autoload": {
"files": [
"lib/helper-functions.php",
"lib/simple_html_dom.php"
],
"psr-4": {
"Pimcore\\Model\\": "models",
"Pimcore\\": "lib",
"Pimcore\\Bundle\\": "bundles"
},
"classmap": [
"lib/Pimcore.php"
],
"exclude-from-classmap": [
"lib/compatibility-stubs.php",
"lib/Pimcore/Bundle/EcommerceFrameworkBundle/config/namespace_compatibility.php"
]
},
"autoload-dev": {
"psr-4": {
"Pimcore\\Tests\\": "tests"
},
"files": [
"app/AppKernel.php"
]
},
"scripts": {
"post-create-project-cmd": "Pimcore\\Composer::postCreateProject",
"post-install-cmd": [
"Pimcore\\Composer::postInstall",
"#pimcore-scripts"
],
"post-update-cmd": [
"Pimcore\\Composer::postUpdate",
"#pimcore-scripts",
"Pimcore\\Composer::executeMigrationsUp"
],
"pimcore-scripts": [
"Pimcore\\Composer::clearCache",
"Pimcore\\Composer::installAssets"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative"
},
"bin": ["bin/pimcore-install"],
"config": {
"preferred-install": {
"symfony/symfony": "source"
}
}
}
Regarding this issue I would to ask two questions:
how to install this package ?
how to check which package is preventing the installation and why?
Your composer.json already lists symfony/symfony as a required package. This contains symfony/mime - as long as you are using Symfony v4.3 or later. The MIME component did not exist before that.
I am implementing a Laravel 7 package but when running my unit test, I am getting a RuntimeException
{
"name": "",
"license": "MIT",
"authors": [
{
"name": "",
"email": ""
}
],
"require": {
"php": "^7.3",
"guzzlehttp/guzzle": "^7.0",
"illuminate/config": "^7.19",
"illuminate/contracts": "^7.19",
"illuminate/http": "^7.19",
"moneyphp/money": "^3.3"
},
"autoload": {
"psr-4": {
"QuickPay\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"QuickPay\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"phpunit/phpunit": "^9.0",
"mockery/mockery": "dev-master",
"nunomaduro/collision": "^5.0",
"pestphp/pest": "^0.2.3"
},
"config": {
"sort-packages": true
}
}
The class I am testing
namespace QuickPay\Ping;
use Illuminate\Support\Facades\Http;
class Ping {
/**
* Send ping request to https://api.quickpay.net/ping
*/
public static function send() {
$response = Http::get('https://api.quickpay.net/ping');
return $response;
}
}
My Unit test
use QuickPay\Ping\Ping;
test('ping request returns pong', function () {
assertEquals([], Ping::send());
});
The exception
• Tests\Unit\PingTest > ping request returns pong
RuntimeException
A facade root has not been set.
at vendor/illuminate/support/Facades/Facade.php:258
254▕ {
255▕ $instance = static::getFacadeRoot();
256▕
257▕ if (! $instance) {
➜ 258▕ throw new RuntimeException('A facade root has not been set.');
259▕ }
260▕
261▕ return $instance->$method(...$args);
262▕ }
1 src/Ping/Ping.php:16
Illuminate\Support\Facades\Facade::__callStatic("get")
2 tests/Unit/PingTest.php:6
QuickPay\Ping\Ping::send()
I have run the composer dump-autoload command.
Trying to install a simple repository using composer (composer require vimeo/vimeo-api ^2.0)
And I can't seem to get it work.
Here's the error
Installation failed, reverting ./composer.json to its original content.
[ErrorException]
Undefined property: Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository::$verbose
Exception trace:
() at /Users/kevin/Documents/projects/hy/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:68
Composer\Util\ErrorHandler::handle() at /Users/kevin/Documents/projects/hy/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:68
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initTags() at /Users/kevin/Documents/projects/hy/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:44
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initialize() at phar:///usr/local/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:185
Composer\Repository\ArrayRepository->getPackages() at phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:104
Composer\DependencyResolver\Pool->addRepository() at /Users/kevin/Documents/projects/hy/vendor/fxp/composer-asset-plugin/Repository/Util.php:60
Fxp\Composer\AssetPlugin\Repository\Util::addRepositoryInstance() at /Users/kevin/Documents/projects/hy/vendor/fxp/composer-asset-plugin/Repository/Util.php:39
Fxp\Composer\AssetPlugin\Repository\Util::addRepository() at /Users/kevin/Documents/projects/hy/vendor/fxp/composer-asset-plugin/Repository/AbstractAssetsRepository.php:140
Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository->whatProvides() at phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:204
Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:193
Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:164
Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:353
Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/Solver.php:217
Composer\DependencyResolver\Solver->solve() at phar:///usr/local/bin/composer.phar/src/Composer/Installer.php:475
Composer\Installer->doInstall() at phar:///usr/local/bin/composer.phar/src/Composer/Installer.php:229
Composer\Installer->run() at phar:///usr/local/bin/composer.phar/src/Composer/Command/RequireCommand.php:228
Composer\Command\RequireCommand->doUpdate() at phar:///usr/local/bin/composer.phar/src/Composer/Command/RequireCommand.php:185
Composer\Command\RequireCommand->execute() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer.phar/src/Composer/Console/Application.php:267
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer.phar/src/Composer/Console/Application.php:106
Composer\Console\Application->run() at phar:///usr/local/bin/composer.phar/bin/composer:61
require() at /usr/local/bin/composer.phar:24
I've tried using composer update, I've tried deleting the fxp/composer-asset-plugin and re-installing. Nothing seems to work.
In addition this is a Yii 2 app.
Per request I'm adding the composer.json into this.
{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Project Template",
"keywords": ["yii2", "framework", "basic", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"repositories": [
],
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-faker": "*"
},
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.15",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"dektrium/yii2-user": "*",
"yiidoc/yii2-redactor": "*",
"kartik-v/yii2-widget-fileinput": "#dev",
"kartik-v/yii2-widget-datepicker": "#dev",
"kartik-v/yii2-widget-datetimepicker": "*",
"kartik-v/yii2-widget-colorinput": "*",
"kartik-v/yii2-grid": "#dev",
"m35/thecsv": "^1.0",
"aweber/aweber": "^1.1",
"sammaye/yii2-mailchimp": "*",
"nickcv/yii2-mandrill": "*",
"ofat/yii2-yashop-ses": "*",
"frostealth/yii2-aws-s3": "#stable",
"drewm/mailchimp-api": "^2.1",
"ruskid/yii2-stripe": "*",
"drewm/drip": "^0.6.0",
"linslin/yii2-curl": "*",
"braintree/braintree_php": "^3.17",
"kartik-v/yii2-widget-timepicker": "*",
"yii-dream-team/yii2-timezone-picker": "^0.1.0",
"bryglen/yii2-sendgrid": "*",
"mailgun/mailgun-php": "^1.8",
"boundstate/yii2-mailgun": "*",
"omnilight/yii2-vuejs": "^1.0",
"jacobbennett/sendyphp": "^1.3",
"yiisoft/yii2-gii": "^2.0",
"vova07/yii2-imperavi-widget": "*",
"froala/yii2-froala-editor": "^2.7",
"marqu3s/yii2-summernote": "dev-master",
"himiklab/yii2-recaptcha-widget": "*",
"activecampaign/api-php": "^2.0",
"kartik-v/yii2-widgets": "*",
"abraham/twitteroauth": "^0.6.6",
"kartik-v/yii2-slider": "*",
"miloschuman/yii2-highcharts-widget": "*",
"yiisoft/yii2-jui": "^2.0",
"stripe/stripe-php": "^6.26",
"kartik-v/yii2-export": "#dev",
"2amigos/yii2-tinymce-widget": "~1.1",
"uploadcare/uploadcare-php": "^2.2"
},
"config": {
"process-timeout": 1800
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
},
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
Thanks in advance.
As far as I can see in the repository for fxp/composer-asset-plugin, it has seen some updates for the property $verbose which is no longer available in current Composer versions. You should update that package.
As it is not listed in your composer.json, some other package seems to require it. And to update the asset plugin, you probably need to update that other package too - check through composer why fxp/composer-asset-plugin which other plugin is responsible for this
I've taken over an existing Drupal project, I've cloned the git repository of the project onto a development server, and ran composer install to install all project dependencies.
When I try to view the website in my browser, I see an error 500 and the apache error logs on the server are showing the following error;
[Mon Jan 14 11:38:41.246259 2019] [php7:error] [pid 1363] [client 80.229.235.74:52957] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 73728 bytes) in /var/www/vhosts/agilit-e/6bc72c45/vendor/composer/ClassLoader.php on line 444
I've increased the available RAM on the server to 3GB, and I've edited my php.ini file to increase available memory to 2GB (confirmed via phpinfo()), but I'm still seeing this error.
Is there any reason why Composer requires so much memory? Here's a copy of my composer.json file for reference.
{
"name": "drupal-composer/drupal-project",
"description": "Project template for Drupal 8 projects with composer",
"type": "project",
"license": "GPL-2.0+",
"authors": [
{
"name": "",
"role": ""
}
],
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "package",
"package": {
"name": "harvesthq/chosen",
"version": "1.6.1",
"type": "drupal-library",
"dist": {
"url": "https://github.com/harvesthq/chosen/releases/download/v1.6.1/chosen_v1.6.1.zip",
"type": "zip"
},
"require": {
"composer/installers": "^1.2.0"
}
}
},
{
"type": "package",
"package": {
"name": "dinbror/blazy",
"version": "1.8.2",
"type": "drupal-library",
"dist": {
"url": "https://github.com/dinbror/blazy/archive/1.8.2.zip",
"type": "zip"
},
"require": {
"composer/installers": "^1.2.0"
}
}
},
{
"type": "vcs",
"url": "https://gitlab.com/leed-collective/capita-cs-base-theme.git"
},
{
"type": "vcs",
"url": "https://gitlab.com/leed-collective/capita-cs-admin-theme.git"
},
{
"type": "vcs",
"url": "https://gitlab.com/leed-collective/capita-cs-base-modules.git"
}
],
"require": {
"composer/installers": "^1.2",
"cweagans/composer-patches": "^1.6",
"dinbror/blazy": "^1.8",
"drupal-composer/drupal-scaffold": "^2.2",
"drupal/access_unpublished": "^1.0#alpha",
"drupal/admin_toolbar": "^1.19",
"drupal/allowed_formats": "^1.1",
"drupal/autocomplete_deluxe": "^1.0",
"drupal/better_exposed_filters": "^3.0",
"drupal/blazy": "^1.0",
"drupal/block_class": "^1.0",
"drupal/block_content_permissions": "^1.0",
"drupal/chosen": "^2.3",
"drupal/config_filter": "^1.0",
"drupal/config_ignore": "^2.1",
"drupal/config_split": "^1.2",
"drupal/console": "~1.0",
"drupal/core": "~8.5.8",
"drupal/ctools": "^3.0",
"drupal/default_content": "^1.0#alpha",
"drupal/devel": "^1.0",
"drupal/diff": "^1.0",
"drupal/draggableviews": "^1.0",
"drupal/easy_breadcrumb": "^1.6",
"drupal/entity_browser": "^1.0",
"drupal/entity_reference_revisions": "^1.3",
"drupal/eu_cookie_compliance": "^1.0",
"drupal/field_group": "^3.0",
"drupal/formblock": "^1.0",
"drupal/google_analytics": "^2.1",
"drupal/google_tag": "^1.0",
"drupal/honeypot": "^1.23",
"drupal/image_style_quality": "^1.3",
"drupal/image_widget_crop": "^2.0",
"drupal/inline_entity_form": "^1.0",
"drupal/ip2country": "^1.8",
"drupal/link_attributes": "^1.1",
"drupal/linkit": "^5.0",
"drupal/media_entity_document": "1.1",
"drupal/media_entity_image": "1.2",
"drupal/media_entity_video": "1.0-beta2",
"drupal/menu_block": "^1.4",
"drupal/menu_breadcrumb": "^1.3",
"drupal/metatag": "^1.3",
"drupal/migrate_plus": "^2.0",
"drupal/migrate_tools": "^2.0",
"drupal/paragraphs": "^1.1",
"drupal/pathauto": "^1.0",
"drupal/pathologic": "^1.0#alpha",
"drupal/rabbit_hole": "^1.0",
"drupal/recreate_block_content": "^2.0",
"drupal/redirect": "^1.0",
"drupal/restrict_ip": "^1.3",
"drupal/search_exclude": "^1.1",
"drupal/search_exclude_nid": "^1.2",
"drupal/signature": "dev-1.x#048ad876778b2e1ad5a3baaabd2210e1e1be7a1e",
"drupal/silent_contribute": "^1.1",
"drupal/simple_sitemap": "^2.7",
"drupal/smtp": "^1.0",
"drupal/social_media_links": "^2.4",
"drupal/styleguide": "^1.0",
"drupal/taxonomy_access_fix": "^2.5",
"drupal/token": "^1.0",
"drupal/token_filter": "^1.0",
"drupal/twig_tweak": "^1.8",
"drupal/username_enumeration_prevention": "^1.0",
"drupal/video_embed_field": "^1.5",
"drupal/video_embed_wistia": "^1.0",
"drupal/views_bulk_edit": "^1.0",
"drupal/views_bulk_operations": "^1.0",
"drupal/webform": "5.0-rc11",
"drush/drush": "~8.0",
"leed-collective/capita_base_theme": "master",
"leed-collective/capita_admin_theme": "master",
"leed-collective/capita-cs-base-modules": "master",
"geerlingguy/drupal-vm": "4.7.0",
"harvesthq/chosen": "^1.6",
"oomphinc/composer-installers-extender": "^1.1",
"webflo/drupal-finder": "^0.3.0",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"behat/mink": "~1.7",
"behat/mink-goutte-driver": "~1.2",
"jcalderonzumba/gastonjs": "~1.0.2",
"jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
"mikey179/vfsstream": "~1.2",
"phpunit/phpunit": ">=4.8.28 <5",
"symfony/css-selector": "~2.8"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"scripts": {
"drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
"pre-install-cmd": [
"DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
],
"pre-update-cmd": [
"DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
],
"post-install-cmd": [
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
],
"post-update-cmd": [
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
]
},
"extra": {
"installer-types": [
"capita-module",
"capita-theme",
"capita-profile"
],
"installer-paths": {
"web/core": [
"type:drupal-core"
],
"web/libraries/{$name}": [
"type:drupal-library"
],
"web/modules/contrib/{$name}": [
"type:drupal-module"
],
"web/modules/capita_base/{$name}": [
"type:capita-module"
],
"web/profiles/contrib/{$name}": [
"type:drupal-profile"
],
"web/profiles/capita_base/{$name}": [
"type:capita-profile"
],
"web/themes/contrib/{$name}": [
"type:drupal-theme"
],
"web/themes/capita_base/{$name}": [
"type:capita-theme"
],
"drush/contrib/{$name}": [
"type:drupal-drush"
]
},
"patches": {
"drupal/core": {
"Fix issue of grouped filters using the array key id for the query rather than the term IDs": "https://www.drupal.org/files/issues/2049603-fixing-tid-in-exposed-group-filter-sql-query-in-views.patch"
},
"drupal/default_content": {
"Allow exporting all taxonomy terms for a given vocab": "https://www.drupal.org/files/issues/default_content-export-all-items-2786479-12.patch",
"Allow existing entities to be updated": "https://www.drupal.org/files/issues/2018-06-05/default_content-dont-reimport-existing-entities-2698425-102.patch",
"Allow manually importing content again, not just on install": "https://www.drupal.org/files/issues/default_content-allow_manual_imports-2640734-72.patch"
},
"drupal/field_group": {
"Tabs with invalid input are not focused": "https://www.drupal.org/files/issues/field-group-tab-focus-invalid-input.patch"
},
"drupal/linkit": {
"Linkit for Link field": "https://www.drupal.org/files/issues/2018-03-25/2712951-59.patch"
}
}
}
}