Downgrade Doctrine ORm 2.5 to 2.4 - php

i want Downgrade Doctrine Orm 2.5 to 2.4 For solve this Error :
syntax error, unexpected '[', expecting ')'
Note : My php Version : 5.3 (Doctrine 2.5 needed to php 5.4 and later version)
And write this Code in Composer.json file :
{
"require": {
"doctrine/common": "2.4.*",
"doctrine/dbal": "2.4.*",
"doctrine/orm": "2.4.*"
}
}
and run composer task in cmd with this Code :
composer install
But Composer Download Doctrine 2.5
How Download Doctrine 2.4 With Composer

I just did a quick test and it downloads 2.4
just put this composer.json into a folder an run composer install:
composer.json
{
"name": "test/test",
"description": "test",
"license": "no",
"require": {
"doctrine/common": "2.4.*",
"doctrine/dbal": "2.4.*",
"doctrine/orm": "2.4.*"
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
As you can see in composer install output, doctrine/common, doctrine/dbal and doctrine/orm are all version 2.4.x. I run the test also with "preferred-install": "source" and "minimum-stability": "dev" same result.
composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing doctrine/lexer (v1.0.1)
Loading from cache
- Installing doctrine/annotations (v1.2.4)
Loading from cache
- Installing doctrine/collections (v1.3.0)
Loading from cache
- Installing doctrine/cache (v1.4.1)
Loading from cache
- Installing doctrine/inflector (v1.0.1)
Loading from cache
- Installing doctrine/common (v2.4.2)
Loading from cache
- Installing symfony/console (v2.6.7)
Loading from cache
- Installing doctrine/dbal (v2.4.4)
Loading from cache
- Installing doctrine/orm (v2.4.7)
Loading from cache
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/process ()
symfony/console suggests installing psr/log (For using the console logger)
doctrine/orm suggests installing symfony/yaml (If you want to use YAML Metadata Mapping Driver)
Writing lock file
Generating autoload files

Related

Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script

We have the below contents on composer.json with dependencies and scripts. This comes from a legacy project where the vendors directory was pushed to GitHub. We're trying to remove that vendors directory from the repository to make its creation a part of the build process.
{
"name": "root/my-portal",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
},
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
"require": {
"php": ">=7.2.1",
"doctrine/doctrine-bundle": "^2.0",
"doctrine/orm": "^2.6",
"incenteev/composer-parameter-handler": "~2.0",
"psr/simple-cache": "^1.0",
"sensio/framework-extra-bundle": "^5.5",
"symfony/monolog-bundle": "^3.4",
"symfony/polyfill-apcu": "^1.2",
"symfony/swiftmailer-bundle": "^3.4.0",
"symfony/symfony": "^4.4"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.0"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"sort-packages": true
},
"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",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": null
}
}
But on a "clean" install of this project, i.e. removing the vendors directory and the composer.lock file before running composer install or composer update, everything seems to work, except for the Sensio part:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 43 installs, 0 updates, 0 removals
- Installing ocramius/package-versions (1.4.2): Downloading (100%)
- Installing psr/container (1.0.0): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
- Installing symfony/contracts (v1.1.10): Downloading (100%)
- Installing symfony/polyfill-php80 (v1.18.1): Downloading (100%)
- Installing symfony/polyfill-php73 (v1.18.1): Downloading (100%)
- Installing symfony/polyfill-php72 (v1.18.1): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.18.1): Downloading (100%)
- Installing paragonie/random_compat (v9.99.99): Downloading (100%)
- Installing symfony/polyfill-php70 (v1.18.1): Downloading (100%)
- Installing symfony/polyfill-intl-normalizer (v1.18.1): Downloading (100%)
- Installing symfony/polyfill-intl-idn (v1.18.1): Downloading (100%)
- Installing symfony/polyfill-intl-icu (v1.18.1): Downloading (100%)
- Installing symfony/symfony (v4.4.14): Downloading (100%)
- Installing symfony/polyfill-ctype (v1.18.1): Downloading (100%)
- Installing psr/log (1.1.3): Downloading (100%)
- Installing psr/link (1.0.0): Loading from cache
- Installing twig/twig (v3.0.5): Downloading (100%)
- Installing doctrine/lexer (1.2.1): Downloading (100%)
- Installing doctrine/annotations (1.10.4): Downloading (100%)
- Installing doctrine/reflection (1.2.1): Downloading (100%)
- Installing doctrine/event-manager (1.1.1): Downloading (100%)
- Installing doctrine/collections (1.6.7): Downloading (100%)
- Installing doctrine/cache (1.10.2): Downloading (100%)
- Installing doctrine/persistence (2.0.0): Downloading (100%)
- Installing symfony/polyfill-apcu (v1.18.1): Downloading (100%)
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing doctrine/sql-formatter (1.1.1): Downloading (100%)
- Installing doctrine/dbal (2.10.4): Downloading (100%)
- Installing doctrine/doctrine-bundle (2.1.2): Downloading (100%)
- Installing doctrine/instantiator (1.3.1): Downloading (100%)
- Installing doctrine/inflector (1.4.3): Downloading (100%)
- Installing doctrine/common (3.0.2): Downloading (100%)
- Installing doctrine/orm (v2.7.3): Downloading (100%)
- Installing incenteev/composer-parameter-handler (v2.1.4): Downloading (100%)
- Installing sensio/framework-extra-bundle (v5.6.1): Downloading (100%)
- Installing monolog/monolog (1.25.5): Downloading (100%)
- Installing symfony/monolog-bundle (v3.5.0): Loading from cache
- Installing symfony/polyfill-iconv (v1.18.1): Downloading (100%)
- Installing egulias/email-validator (2.1.22): Downloading (100%)
- Installing swiftmailer/swiftmailer (v6.2.3): Loading from cache
- Installing symfony/swiftmailer-bundle (v3.5.0): Downloading (100%)
- Installing symfony/phpunit-bridge (v4.4.14): Downloading (100%)
symfony/contracts suggests installing symfony/cache-implementation
symfony/contracts suggests installing symfony/event-dispatcher-implementation
symfony/contracts suggests installing symfony/http-client-implementation
symfony/contracts suggests installing symfony/service-implementation
symfony/contracts suggests installing symfony/translation-implementation
symfony/contracts suggests installing psr/event-dispatcher (When using the EventDispatcher contracts)
symfony/polyfill-mbstring suggests installing ext-mbstring (For best performance)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/polyfill-intl-normalizer suggests installing ext-intl (For best performance)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
symfony/polyfill-intl-icu suggests installing ext-intl (For best performance)
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation)
swiftmailer/swiftmailer suggests installing ext-intl (Needed to support internationalized email addresses)
swiftmailer/swiftmailer suggests installing true/punycode (Needed to support internationalized email addresses, if ext-intl is not installed)
Writing lock file
Generating autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
And we can't find what could be wrong here. Any ideas?
I copied your composer.json to my local environment and ran composer update and had the same results. The problem is, that the class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler does not exist with your config. So I executed composer require sensio/distribution-bundle, but then I got a version conflict:
[...]
- sensio/distribution-bundle v5.0.0 requires symfony/process ~2.3|~3.0
[...]
- don't install symfony/process v3.4.9|don't install symfony/symfony v4.4.14
- Installation request for symfony/symfony (locked at v4.4.14, required as ^4.4) -> satisfiable by symfony/symfony[v4.4.14].
The SensioDistrubutionBundle has been archived:
WARNING: This bundle does not support Symfony 4. Symfony Flex is a total replacement for this bundle.
I guess your best option is to check the Symfony Flex docs about what's necessary to upgrade to Flex OR rely on an older Symfony Framework version in order to use the SensioDistrubutionBundle.

Symfony 4, migration to production, the command "composer install --no-dev" fail (ClassNotFoundException : WebProfilerBundle)

En dev environment when I run the command composer install I haven't any problem. I want to deploy my symfony app in an another server (a prod server), however, when I run the command composer install --no-dev I get an error and I don't find/understand what is the problem.
The logs are :
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 118 installs, 0 updates, 0 removals
- Installing ocramius/package-versions (1.3.0): Loading from cache
- Installing symfony/flex (v1.1.8): Loading from cache
- Installing symfony/yaml (v4.1.10): Loading from cache
- Installing symfony/finder (v4.1.10): Loading from cache
- ...
- Installing symfony/web-link (v4.1.10): Loading from cache
- Installing symfony/asset (v4.1.10): Loading from cache
- Installing symfony/webpack-encore-pack (v1.0.3): Loading from cache
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
!! Did you forget a "use" statement for another namespace? in /var/www/myapp/src/Kernel.php:33
!! Stack trace:
!! #0 /var/www/myapp/vendor/symfony/http-kernel/Kernel.php(405): App\Kernel->registerBundles()
!! #1 /var/www/myapp/vendor/symfony/http-kernel/Kernel.php(120): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 /var/www/myapp/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 /var/www/myapp/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 /var/www/myapp/bin/console(39): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
!! #5 {main}
!! thrown in /var/www/myapp/src/Kernel.php on line 33
!!
Script #auto-scripts was called via post-install-cmd
My composer.json :
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"codeception/codeception": "^2.5",
"doctrine/doctrine-fixtures-bundle": "^3.0",
"friendsofsymfony/jsrouting-bundle": "^2.2",
"sensio/framework-extra-bundle": "^5.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "*",
"symfony/console": "*",
"symfony/dotenv": "*",
"symfony/expression-language": "*",
"symfony/flex": "^1.1",
"symfony/form": "*",
"symfony/framework-bundle": "*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "*",
"symfony/security-bundle": "*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/twig-bundle": "*",
"symfony/validator": "*",
"symfony/web-link": "*",
"symfony/webpack-encore-pack": "^1.0",
"symfony/yaml": "*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "^1.0",
"symfony/web-server-bundle": "*"
},
"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.1.*"
}
}
}
Thanks for any help/tips ! I'm not a great composer user :/
Edit, the complete output of the command composer install --no-dev :
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 118 installs, 0 updates, 0 removals
- Installing ocramius/package-versions (1.3.0): Loading from cache
- Installing symfony/flex (v1.1.8): Loading from cache
- Installing symfony/yaml (v4.1.10): Loading from cache
- Installing symfony/finder (v4.1.10): Loading from cache
- Installing symfony/event-dispatcher (v4.1.10): Loading from cache
- Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache
- Installing symfony/dom-crawler (v4.1.10): Loading from cache
- Installing symfony/css-selector (v4.1.10): Loading from cache
- Installing symfony/console (v4.1.10): Loading from cache
- Installing symfony/browser-kit (v4.1.10): Loading from cache
- Installing ralouphie/getallheaders (2.0.5): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing guzzlehttp/psr7 (1.5.2): Loading from cache
- Installing guzzlehttp/promises (v1.3.1): Loading from cache
- Installing guzzlehttp/guzzle (6.3.3): Loading from cache
- Installing symfony/process (v4.1.10): Loading from cache
- Installing facebook/webdriver (1.6.0): Loading from cache
- Installing sebastian/version (2.0.1): Loading from cache
- Installing sebastian/resource-operations (2.0.1): Loading from cache
- Installing sebastian/recursion-context (3.0.0): Loading from cache
- Installing sebastian/object-reflector (1.1.1): Loading from cache
- Installing sebastian/object-enumerator (3.0.3): Loading from cache
- Installing sebastian/global-state (2.0.0): Loading from cache
- Installing sebastian/exporter (3.1.0): Loading from cache
- Installing sebastian/environment (4.0.1): Loading from cache
- Installing sebastian/diff (3.0.1): Loading from cache
- Installing sebastian/comparator (3.0.2): Loading from cache
- Installing phpunit/php-timer (2.0.0): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing phpunit/php-file-iterator (2.0.2): Loading from cache
- Installing theseer/tokenizer (1.1.0): Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
- Installing phpunit/php-token-stream (3.0.1): Loading from cache
- Installing phpunit/php-code-coverage (6.1.4): Loading from cache
- Installing webmozart/assert (1.4.0): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
- Installing doctrine/instantiator (1.1.0): Loading from cache
- Installing phpspec/prophecy (1.8.0): Loading from cache
- Installing phar-io/version (2.0.1): Loading from cache
- Installing phar-io/manifest (1.0.3): Loading from cache
- Installing myclabs/deep-copy (1.8.1): Loading from cache
- Installing phpunit/phpunit (7.5.2): Loading from cache
- Installing codeception/stub (2.0.4): Loading from cache
- Installing codeception/phpunit-wrapper (7.6.1): Loading from cache
- Installing behat/gherkin (v4.6.0): Loading from cache
- Installing codeception/codeception (2.5.2): Loading from cache
- Installing doctrine/lexer (v1.0.1): Loading from cache
- Installing doctrine/annotations (v1.6.0): Loading from cache
- Installing doctrine/reflection (v1.0.0): Loading from cache
- Installing doctrine/event-manager (v1.0.0): Loading from cache
- Installing doctrine/collections (v1.5.0): Loading from cache
- Installing doctrine/cache (v1.8.0): Loading from cache
- Installing doctrine/persistence (v1.1.0): Loading from cache
- Installing doctrine/inflector (v1.3.0): Loading from cache
- Installing doctrine/common (v2.10.0): Loading from cache
- Installing symfony/doctrine-bridge (v4.1.10): Loading from cache
- Installing doctrine/doctrine-cache-bundle (1.3.5): Loading from cache
- Installing symfony/routing (v4.1.10): Loading from cache
- Installing symfony/http-foundation (v4.1.10): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v4.1.10): Loading from cache
- Installing symfony/http-kernel (v4.1.10): Loading from cache
- Installing symfony/filesystem (v4.1.10): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/dependency-injection (v4.1.10): Loading from cache
- Installing symfony/config (v4.1.10): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
- Installing symfony/cache (v4.1.10): Loading from cache
- Installing symfony/framework-bundle (v4.1.10): Loading from cache
- Installing jdorn/sql-formatter (v1.2.17): Loading from cache
- Installing doctrine/dbal (v2.9.2): Loading from cache
- Installing doctrine/doctrine-bundle (1.10.1): Loading from cache
- Installing doctrine/data-fixtures (v1.3.1): Loading from cache
- Installing doctrine/doctrine-fixtures-bundle (3.1.0): Loading from cache
- Installing symfony/stopwatch (v4.1.10): Loading from cache
- Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
- Installing zendframework/zend-code (3.3.1): Loading from cache
- Installing ocramius/proxy-manager (2.2.2): Loading from cache
- Installing doctrine/migrations (v2.0.0): Loading from cache
- Installing egulias/email-validator (2.1.7): Loading from cache
- Installing willdurand/jsonp-callback-validator (v1.1.0): Loading from cache
- Installing symfony/serializer (v4.1.10): Loading from cache
- Installing friendsofsymfony/jsrouting-bundle (2.2.2): Loading from cache
- Installing sensio/framework-extra-bundle (v5.2.4): Loading from cache
- Installing symfony/apache-pack (v1.0.1): Loading from cache
- Installing symfony/dotenv (v4.1.10): Loading from cache
- Installing symfony/expression-language (v4.1.10): Loading from cache
- Installing symfony/inflector (v4.1.10): Loading from cache
- Installing symfony/property-access (v4.1.10): Loading from cache
- Installing symfony/options-resolver (v4.1.10): Loading from cache
- Installing symfony/intl (v4.1.10): Loading from cache
- Installing symfony/polyfill-intl-icu (v1.10.0): Loading from cache
- Installing symfony/form (v4.1.10): Loading from cache
- Installing monolog/monolog (1.24.0): Loading from cache
- Installing symfony/monolog-bridge (v4.1.10): Loading from cache
- Installing symfony/monolog-bundle (v3.3.1): Loading from cache
- Installing doctrine/orm (v2.6.3): Loading from cache
- Installing doctrine/doctrine-migrations-bundle (v2.0.0): Loading from cache
- Installing symfony/orm-pack (v1.0.6): Loading from cache
- Installing symfony/security (v4.1.10): Loading from cache
- Installing symfony/security-bundle (v4.1.10): Loading from cache
- Installing symfony/property-info (v4.1.10): Loading from cache
- Installing symfony/serializer-pack (v1.0.2): Loading from cache
- Installing swiftmailer/swiftmailer (v6.1.3): Loading from cache
- Installing symfony/swiftmailer-bundle (v3.2.5): Loading from cache
- Installing twig/twig (v2.6.2): Loading from cache
- Installing symfony/twig-bridge (v4.1.10): Loading from cache
- Installing symfony/twig-bundle (v4.1.10): Loading from cache
- Installing symfony/translation (v4.1.10): Loading from cache
- Installing symfony/validator (v4.1.10): Loading from cache
- Installing psr/link (1.0.0): Loading from cache
- Installing fig/link-util (1.0.0): Loading from cache
- Installing symfony/web-link (v4.1.10): Loading from cache
- Installing symfony/asset (v4.1.10): Loading from cache
- Installing symfony/webpack-encore-pack (v1.0.3): Loading from cache
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
!! Did you forget a "use" statement for another namespace? in /var/www/symepty/src/Kernel.php:33
!! Stack trace:
!! #0 /var/www/symepty/vendor/symfony/http-kernel/Kernel.php(405): App\Kernel->registerBundles()
!! #1 /var/www/symepty/vendor/symfony/http-kernel/Kernel.php(120): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 /var/www/symepty/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 /var/www/symepty/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 /var/www/symepty/bin/console(39): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
!! #5 {main}
!! thrown in /var/www/symepty/src/Kernel.php on line 33
!!
Script #auto-scripts was called via post-install-cmd
It was really stupid x) I just forgot to set the APP_ENV var in .env file to 'prod' :
APP_ENV=dev
to
APP_ENV=prod
and clear caches & vendor before the composer install : rm -rf vendor && var/cache
Check what bundles are activated in prod environment.
see: config/bundles.php file
and you should see some as:
return [
...
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
...
]
Try to run
SYMFONY_ENV=PROD bin/console doctrine:migrations:migrate

Laravel "new project" installs a bunch of apps

I am completely new to Laravel.
I use Vagrant and virtual machine so I installed composer aand laravel installer there.
When I create new project each time I see that it also installs a bunch of other apps. It says
Crafting application... Loading composer repositories with package
information Installing dependencies (including require-dev) from lock
file Package operations: 70 installs, 0 updates, 0 removals
then goes a list of apps it installs
- Installing doctrine/inflector (v1.3.0): Loading from cache
- Installing doctrine/lexer (v1.0.1): Loading from cache
- Installing dragonmantank/cron-expression (v2.0.0): Loading from cache
- Installing erusev/parsedown (1.7.1): Loading from cache
- Installing vlucas/phpdotenv (v2.4.0): Loading from cache
- Installing symfony/css-selector (v4.0.6): Loading from cache
- Installing tijsverkoyen/css-to-inline-styles (2.2.1): Loading from cache
- Installing symfony/polyfill-php72 (v1.7.0): Loading from cache
- Installing symfony/polyfill-mbstring (v1.7.0): Loading from cache
- Installing symfony/var-dumper (v4.0.6): Loading from cache
- Installing symfony/routing (v4.0.6): Loading from cache
- Installing symfony/process (v4.0.6): Loading from cache
- Installing symfony/http-foundation (v4.0.6): Loading from cache
- Installing symfony/event-dispatcher (v4.0.6): Loading from cache
- Installing psr/log (1.0.2): Loading from cache
- Installing symfony/debug (v4.0.6): Loading from cache
- Installing symfony/http-kernel (v4.0.6): Loading from cache
- Installing symfony/finder (v4.0.6): Loading from cache
- Installing symfony/console (v4.0.6): Loading from cache
- Installing egulias/email-validator (2.1.3): Loading from cache
- Installing swiftmailer/swiftmailer (v6.0.2): Loading from cache
- Installing paragonie/random_compat (v2.0.11): Loading from cache
- Installing ramsey/uuid (3.7.3): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/translation (v4.0.6): Loading from cache
- Installing nesbot/carbon (1.25.0): Loading from cache
- Installing monolog/monolog (1.23.0): Loading from cache
- Installing league/flysystem (1.0.43): Loading from cache
- Installing laravel/framework (v5.6.14): Downloading (100%)
- Installing fideloper/proxy (4.0.0): Loading from cache
- Installing jakub-onderka/php-console-color (0.1): Loading from cache
- Installing nikic/php-parser (v3.1.5): Loading from cache
and etc.
Is it okay, or am I doing something wrong?
I use command
laravel new exampleProject
You aren't doing anything wrong, that's the expected behaviour when you install a Laravel project dependencies.
The thing is composer not only installs the dependencies listed in that project composer.json but also the dependencies of the dependencies and so on recursively.
For example, the Laravel application composer file requires the following dependencies:
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0"
}
but composer has to make sure you also have every dependency needed to run these, so it looks in their respective composer.json files, like in the laravel/framework one, which contains this:
"require": {
"php": "^7.1.3",
"ext-mbstring": "*",
"ext-openssl": "*",
"doctrine/inflector": "~1.1",
"dragonmantank/cron-expression": "~2.0",
"erusev/parsedown": "~1.7",
"league/flysystem": "^1.0.8",
"monolog/monolog": "~1.12",
"nesbot/carbon": "^1.24.1",
"psr/container": "~1.0",
"psr/simple-cache": "^1.0",
"ramsey/uuid": "^3.7",
"swiftmailer/swiftmailer": "~6.0",
"symfony/console": "~4.0",
"symfony/debug": "~4.0",
"symfony/finder": "~4.0",
"symfony/http-foundation": "~4.0",
"symfony/http-kernel": "~4.0",
"symfony/process": "~4.0",
"symfony/routing": "~4.0",
"symfony/var-dumper": "~4.0",
"tijsverkoyen/css-to-inline-styles": "^2.2.1",
"vlucas/phpdotenv": "~2.2"
}
it installs them and so on and so forth until it has fulfilled every dependency.
As you can imagine this can add up fast, and once installed every single dependency in your project is listed in your composer.lock file if you want to check them out.
That's why you are getting more dependencies installed than you were expecting.

Why Composer require jquery installs unwanted PHP packages?

I just wanted jQuery and entered in the command line
composer require components/jquery ^1.11
But the log shows me:
Package operations: 4 installs, 0 updates, 0 removals
- Installing symfony/process (v3.2.7): Loading from cache
- Installing kriswallsmith/assetic (v1.4.0): Loading from cache
- Installing robloach/component-installer (0.2.3): Loading from cache
- Installing components/jquery (1.11.0): Loading from cache
Why does Composer install PHP related packages I never intended to install? And how do I get rid of the unwanted packages? Is there an better/cleaner install method?
you are trying to install on of 1.11 versions of a package, which is requires "robloach/component-installer" package to install , you can see that clearly here :
"require": {
"robloach/component-installer": "*"
},
however, robloach/component-installer requires some additional packages too,
also you can see that here
"require": {
"php": ">=5.3.2",
"kriswallsmith/assetic": "1.*",
"composer-plugin-api": "^1.0"
},

unable to make bake work with cakePhp 3.2

I'm trying to create new local project with cakephp 3.2, following the cakephp doc, on wamp local server. I used composer to install it.
Everythings seems ok after installation : I configure my db access on app.php and the cakephp default homepage confirms that everything is OK with the configuration (PHP version & extensions OK / write rights OK / connect to db OK)
But when I try to use bake commands (from my project root directory), I've got an error :
$ bin/cake bake
Could not open input file: /cygdrive/c/wamp64/www/cemafor/bin/cake.php
However, the file c/wamp64/www/cemafor/bin/cake.php exists !
I try to use "./bin/cake bake" command (according to cakephp bake doc recommendation), still the same error.
Try also to remove and reinstall the project, no change.
I saw the bake version installed was 1.2.1 (see the result of install command). I've looked into /composer.json file, and saw this :
"require-dev": {
"psy/psysh": "#stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "~1.1"
},
So I try to change version value for cakephp/bake version by this :
"cakephp/bake": "~1.2"
But doesn't change anything...
I try to install version 1.0 according to bake doc but doesn't work.
And unable to find a single person having the same problem... feel alone in the world with a stupid bug ^^
Thanks a lot for your help !
For information, here is the result of the instal command :
$ composer create-project --prefer-dist cakephp/app cemafor
Installing cakephp/app (3.2.1)
- Installing cakephp/app (3.2.1)
Loading from cache
Created project in cemafor
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing aura/installer-default (1.0.0)
Loading from cache
- Installing cakephp/plugin-installer (0.0.12)
Loading from cache
- Installing psr/log (1.0.0)
Loading from cache
- Installing mobiledetect/mobiledetectlib (2.8.19)
Loading from cache
- Installing aura/intl (1.1.1)
Loading from cache
- Installing cakephp/chronos (0.4.7)
Loading from cache
- Installing cakephp/cakephp (3.2.3)
Loading from cache
- Installing symfony/yaml (v3.0.3)
Loading from cache
- Installing symfony/filesystem (v3.0.3)
Loading from cache
- Installing symfony/config (v3.0.3)
Loading from cache
- Installing symfony/polyfill-mbstring (v1.1.0)
Loading from cache
- Installing symfony/console (v3.0.3)
Loading from cache
- Installing robmorgan/phinx (v0.5.1)
Loading from cache
- Installing cakephp/migrations (1.5.6)
Loading from cache
- Installing jakub-onderka/php-console-color (0.1)
Loading from cache
- Installing jakub-onderka/php-console-highlighter (v0.3.2)
Loading from cache
- Installing dnoegel/php-xdg-base-dir (0.1)
Loading from cache
- Installing nikic/php-parser (v2.0.1)
Loading from cache
- Installing symfony/var-dumper (v3.0.3)
Loading from cache
- Installing psy/psysh (v0.7.1)
Loading from cache
- Installing jdorn/sql-formatter (v1.2.17)
Loading from cache
- Installing cakephp/debug_kit (3.2.6)
Loading from cache
- Installing cakephp/bake (1.2.1)
Loading from cache
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/process ()
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))
psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)
psy/psysh suggests installing ext-readline (Enables support for arrow-key history navigation, and showing and manipulating command history.)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
cakephp/debug_kit suggests installing ext-sqlite (DebugKit needs to store panel data in a database. SQLite is simple and easy to use.)
Writing lock file
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump
> App\Console\Installer::postInstall
Created `config/app.php` file
Set Folder Permissions ? (Default to Y) [Y,n]? Y
Updated Security.salt value in config/app.php
And here is my composer.json content :
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": "~3.2",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*"
},
"require-dev": {
"psy/psysh": "#stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "^1.2"
},
"suggest": {
"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-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"minimum-stability": "stable",
"prefer-stable": true
}
Finally succeed !
...fiercely helps compensate incompetence ^^
I follow the steps here : https://stackoverflow.com/a/14904607/2614077.
On the step 4, when I edit /bin/php file (in notepadd++ in my case), I have 2 small operations to do to make it work :
convert document to a UNIX format
encode it on UTF8 (without BOM)
This time everything work fine.
Happy to finally been abble to solve this problem.
Thanks a lot.

Categories