I upgraded from Symfony 3.4 to 4.4.
Since v4.2 setCallbacks() and setCircularReferenceHandler() are deprecated so I replaced them by passing context to ObjectNormalizer.
Actually this is working BUT when I have a lot of entity (hundreds or thousands) to serialize it takes more than 30 seconds and obviously throws a timed-out.
For example, in 3.4 it takes 7 seconds to serialize 1444 objects, it takes +30 seconds in 4.4.
Before:
class MyEntitySerializer extends Serializer
{
public function __construct(ObjectNormalizer $normalizer, JsonEncoder $encoder)
{
$dateCallback = function ($dateTime) {
return $dateTime instanceof \DateTime
? date_format($dateTime,'d/m/Y')
: null;
};
$normalizer->setCallbacks([
'debut' => $dateCallback,
'fin' => $dateCallback,
'demandeDate' => $dateCallback,
'dateCreation' => $dateCallback,
]);
$normalizer->setCircularReferenceHandler(function ($object) {
if ($object instanceof Affaire) {
return $object->getCode();
} elseif ($object instanceof ComplementAffaire) {
return $object->getDescription();
}
return $object->getId();
});
parent::__construct([$normalizer], [$encoder]);
}
}
After:
class MyEntitySerializer extends Serializer
{
public function __construct(ObjectNormalizer $normalizer, JsonEncoder $encoder)
{
$dateCallback = function ($dateTime) {
return $dateTime instanceof \DateTime
? date_format($dateTime,'d/m/Y')
: null;
};
$defaultContext = [
AbstractNormalizer::CALLBACKS => [
'debut' => $dateCallback,
'fin' => $dateCallback,
'demandeDate' => $dateCallback,
'dateCreation' => $dateCallback,
],
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function ($object) {
if ($object instanceof Affaire) {
return $object->getCode();
} elseif ($object instanceof ComplementAffaire) {
return $object->getDescription();
}
return $object->getId();
}
];
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$normalizer = new ObjectNormalizer($classMetadataFactory,null,null,null,null,null,$defaultContext);
parent::__construct([$normalizer], [$encoder]);
}
}
I injected ClassMetadataFactoryInterface and pass it to ObjectNormalizer, here's what this serializer looks like :
enter image description here
There are no CacheClassMetadataFactory. It worked like before (as slow as before).
I tried remove var/cache/ and vendor/ then I did a composer install
here's the installed versions:
- Installing composer/package-versions-deprecated (1.8.1): Loading from cache
- Installing symfony/flex (v1.8.4): Loading from cache
- Installing squizlabs/php_codesniffer (3.5.5): Loading from cache
- Installing dealerdirect/phpcodesniffer-composer-installer (v0.6.2): Loading from cache
- Installing behat/transliterator (v1.3.0): Loading from cache
- Installing clue/stream-filter (v1.4.1): Loading from cache
- Installing doctrine/lexer (1.2.1): Loading from cache
- Installing doctrine/annotations (1.10.3): Loading from cache
- Installing doctrine/reflection (1.2.1): Loading from cache
- Installing doctrine/event-manager (1.1.0): Loading from cache
- Installing doctrine/collections (1.6.6): Loading from cache
- Installing doctrine/cache (1.10.2): Loading from cache
- Installing doctrine/persistence (1.3.7): Loading from cache
- Installing doctrine/inflector (1.4.3): Loading from cache
- Installing doctrine/common (2.13.3): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
- Installing symfony/contracts (v1.1.8): Loading from cache
- Installing symfony/polyfill-mbstring (v1.17.1): Loading from cache
- Installing symfony/polyfill-ctype (v1.17.1): Loading from cache
- Installing symfony/doctrine-bridge (v4.4.10): Loading from cache
- Installing doctrine/doctrine-cache-bundle (1.4.0): Loading from cache
- Installing doctrine/instantiator (1.3.1): Loading from cache
- Installing symfony/polyfill-php80 (v1.17.1): Loading from cache
- Installing symfony/polyfill-php73 (v1.17.1): Loading from cache
- Installing symfony/console (v4.4.10): Loading from cache
- Installing laminas/laminas-zendframework-bridge (1.0.4): Loading from cache
- Installing laminas/laminas-eventmanager (3.2.1): Loading from cache
- Installing laminas/laminas-code (3.4.1): Loading from cache
- Installing ocramius/proxy-manager (2.2.3): Loading from cache
- Installing doctrine/dbal (2.10.2): Loading from cache
- Installing doctrine/migrations (v1.8.1): Loading from cache
- Installing willdurand/jsonp-callback-validator (v1.1.0): Loading from cache
- Installing symfony/serializer (v4.4.10): Loading from cache
- Installing symfony/routing (v4.4.10): Loading from cache
- Installing symfony/deprecation-contracts (v2.1.3): Loading from cache
- Installing symfony/http-foundation (v5.1.2): Loading from cache
- Installing symfony/event-dispatcher (v4.4.10): Loading from cache
- Installing symfony/var-dumper (v5.1.2): Loading from cache
- Installing psr/log (1.1.3): Loading from cache
- Installing symfony/debug (v4.4.10): Loading from cache
- Installing symfony/error-handler (v4.4.10): Loading from cache
- Installing symfony/http-kernel (v4.4.10): Loading from cache
- Installing symfony/finder (v5.1.2): Loading from cache
- Installing symfony/filesystem (v5.1.2): Loading from cache
- Installing symfony/dependency-injection (v4.4.10): Loading from cache
- Installing symfony/config (v4.4.10): Loading from cache
- Installing symfony/var-exporter (v5.1.2): Loading from cache
- Installing symfony/cache (v5.1.2): Loading from cache
- Installing symfony/framework-bundle (v4.4.10): Loading from cache
- Installing friendsofsymfony/jsrouting-bundle (2.6.0): Loading from cache
- Installing symfony/polyfill-php72 (v1.17.0): Loading from cache
- Installing symfony/polyfill-intl-idn (v1.17.1): Loading from cache
- Installing ralouphie/getallheaders (3.0.3): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing guzzlehttp/psr7 (1.6.1): Loading from cache
- Installing guzzlehttp/promises (v1.3.1): Loading from cache
- Installing guzzlehttp/guzzle (6.5.5): Loading from cache
- Installing psr/http-factory (1.0.1): Loading from cache
- Installing http-interop/http-factory-guzzle (1.0.0): Loading from cache
- Installing symfony/yaml (v5.1.2): Loading from cache
- Installing incenteev/composer-parameter-handler (v2.1.4): Loading from cache
- Installing jdorn/sql-formatter (v1.2.17): Loading from cache
- Installing knplabs/knp-menu (2.6.0): Loading from cache
- Installing knplabs/knp-menu-bundle (v2.3.0): Loading from cache
- Installing symfony/process (v5.1.2): Loading from cache
- Installing knplabs/knp-snappy (v1.2.1): Loading from cache
- Installing knplabs/knp-snappy-bundle (v1.7.0): Loading from cache
- Installing php-http/message-factory (v1.0.2): Loading from cache
- Installing php-http/promise (1.1.0): Loading from cache
- Installing psr/http-client (1.0.1): Loading from cache
- Installing sensio/framework-extra-bundle (v5.5.6): Loading from cache
- Installing paragonie/random_compat (v9.99.99): Loading from cache
- Installing symfony/polyfill-uuid (v1.17.1): Loading from cache
- Installing symfony/options-resolver (v5.1.2): Loading from cache
- Installing php-http/message (1.8.0): Loading from cache
- Installing php-http/httplug (2.1.0): Loading from cache
- Installing php-http/discovery (1.9.0): Loading from cache
- Installing php-http/client-common (2.2.0): Loading from cache
- Installing php-http/guzzle6-adapter (v2.0.1): Loading from cache
- Installing jean85/pretty-package-versions (1.5.0): Loading from cache
- Installing sentry/sentry (2.4.1): Loading from cache
- Installing symfony/security-core (v4.4.0): Loading from cache
- Installing sentry/sdk (2.1.0)
- Installing sentry/sentry-symfony (3.5.2): Loading from cache
- Installing gedmo/doctrine-extensions (v2.4.41): Loading from cache
- Installing stof/doctrine-extensions-bundle (v1.4.0): Loading from cache
- Installing twig/twig (v2.13.0): Loading from cache
- Installing symfony/twig-bridge (v4.4.10): Loading from cache
- Installing symfony/debug-bundle (v4.4.10): Loading from cache
- Installing symfony/dotenv (v4.4.10): Loading from cache
- Installing symfony/expression-language (v4.4.10): Loading from cache
- Installing symfony/polyfill-intl-normalizer (v1.17.1): Loading from cache
- Installing symfony/polyfill-intl-grapheme (v1.17.1): Loading from cache
- Installing symfony/string (v5.1.2): Loading from cache
- Installing symfony/inflector (v5.1.2): Loading from cache
- Installing symfony/mime (v5.1.2): Loading from cache
- Installing egulias/email-validator (2.1.18): Loading from cache
- Installing symfony/mailer (v4.4.10): Loading from cache
- Installing monolog/monolog (2.1.0): Loading from cache
- Installing symfony/monolog-bridge (v5.1.2): Loading from cache
- Installing symfony/monolog-bundle (v3.5.0): Loading from cache
- Installing doctrine/orm (v2.7.3): Loading from cache
- Installing doctrine/doctrine-bundle (1.12.0): Loading from cache
- Installing doctrine/doctrine-migrations-bundle (v1.3.2): Loading from cache
- Installing symfony/orm-pack (v1.0.8): Loading from cache
- Installing symfony/polyfill-apcu (v1.17.1): Loading from cache
- Installing symfony/polyfill-iconv (v1.17.1): Loading from cache
- Installing symfony/polyfill-intl-icu (v1.17.1): Loading from cache
- Installing symfony/intl (v5.1.2): Loading from cache
- Installing symfony/property-access (v4.4.10): Loading from cache
- Installing symfony/security-http (v4.4.6): Loading from cache
- Installing symfony/security-guard (v4.4.10): Loading from cache
- Installing symfony/security-csrf (v5.1.2): Loading from cache
- Installing symfony/security-bundle (v4.4.10): Loading from cache
- Installing swiftmailer/swiftmailer (v6.2.3): Loading from cache
- Installing symfony/swiftmailer-bundle (v3.4.0): Loading from cache
- Installing symfony/twig-bundle (v4.4.10): Loading from cache
- Installing twig/extra-bundle (v3.0.4): Loading from cache
- Installing symfony/twig-pack (v1.0.0): Loading from cache
- Installing symfony/validator (v4.4.10): Loading from cache
- Installing symfony/asset (v4.4.10): Loading from cache
- Installing symfony/webpack-encore-bundle (v1.7.3): Loading from cache
- Installing tecnickcom/tcpdf (6.3.5): Loading from cache
- Installing symfony/form (v4.4.10): Loading from cache
- Installing jms/metadata (2.3.0): Loading from cache
- Installing vich/uploader-bundle (1.14.0): Loading from cache
- Installing symfony/translation (v4.4.10): Loading from cache
- Installing willdurand/js-translation-bundle (3.0.1): Loading from cache
- Installing doctrine/data-fixtures (1.4.3): Loading from cache
- Installing doctrine/doctrine-fixtures-bundle (3.3.1): Loading from cache
- Installing nikic/php-parser (v4.6.0): Loading from cache
- Installing symfony/maker-bundle (v1.19.1): Loading from cache
- Installing symfony/web-profiler-bundle (v5.0.10): Loading from cache
- Installing symfony/stopwatch (v5.1.2): Loading from cache
- Installing symfony/profiler-pack (v1.0.4): Loading from cache
This is happening because of this line:
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
When you get ObjectNormalizer from service container rather than instantiating it yourself, it receives this metadataFactory (it is from a container dump):
return $container->privates['serializer.mapping.cache_class_metadata_factory'] = new \Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory(
new \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory(
new \Symfony\Component\Serializer\Mapping\Loader\LoaderChain(
[
0 => new \Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader(
($container->privates['annotations.cached_reader'] ?? $container->getAnnotations_CachedReaderService(
))
),
]
)
),
\Symfony\Component\Cache\Adapter\PhpArrayAdapter::create(
($container->targetDir . '' . '/serialization.php'),
($container->privates['cache.serializer'] ?? $container->load('getCache_SerializerService'))
)
);
It is using cache.
In vendor/symfony/framework-bundle/Resources/config/serializer.xml you can see the following:
<service id="serializer.mapping.class_metadata_factory" class="Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory">
<argument type="service" id="serializer.mapping.chain_loader" />
</service>
<service id="Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface" alias="serializer.mapping.class_metadata_factory" />
...
<service id="serializer.mapping.cache_class_metadata_factory" decorates="serializer.mapping.class_metadata_factory" class="Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory">
<argument type="service" id="serializer.mapping.cache_class_metadata_factory.inner" />
<argument type="service" id="serializer.mapping.cache.symfony" />
</service>
Service serializer.mapping.cache_class_metadata_factory decorates serializer.mapping.class_metadata_factory which has an alias Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface.
So you can inject '#Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface' service to MyEntitySerializer and use it to create your ObjectNormalizer instance.
Related
I was facing an issue to install laravel in my ubuntu. Please help me.
composer create-project laravel/laravel blog
I am getting this error. I had tried various options to solve this. And it never happened before.
Installing laravel/laravel (v8.0.1)
Installing laravel/laravel (v8.0.1): Loading from cache
Created project in blog
> #php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 106 installs, 0 updates, 0 removals
Installing voku/portable-ascii (1.5.3): Loading from cache
Installing symfony/polyfill-php80 (v1.18.1): Loading from cache
Installing symfony/polyfill-mbstring (v1.18.1): Loading from cache
Installing symfony/polyfill-ctype (v1.18.1): Loading from cache
Installing phpoption/phpoption (1.7.5): Loading from cache
Installing graham-campbell/result-type (v1.0.1): Loading from cache
Installing vlucas/phpdotenv (v5.1.0): Loading from cache
Installing symfony/css-selector (v5.1.5): Loading from cache
Installing tijsverkoyen/css-to-inline-styles (2.2.3): Loading from cache
Installing symfony/var-dumper (v5.1.5): Loading from cache
Installing symfony/deprecation-contracts (v2.2.0): Loading from cache
Installing symfony/routing (v5.1.5): Loading from cache
Installing symfony/process (v5.1.5): Loading from cache
Installing symfony/polyfill-php72 (v1.18.1): Loading from cache
Installing paragonie/random_compat (v9.99.99): Loading from cache
Installing symfony/polyfill-php70 (v1.18.1): Loading from cache
Installing symfony/polyfill-intl-normalizer (v1.18.1): Loading from cache
Installing symfony/polyfill-intl-idn (v1.18.1): Loading from cache
Installing symfony/mime (v5.1.5): Loading from cache
Installing symfony/polyfill-intl-grapheme (v1.18.1): Loading from cache
Installing symfony/string (v5.1.5): Loading from cache
Installing phpdocumentor/reflection-common (2.2.0): Loading from cache
Installing webmozart/assert (1.9.1): Loading from cache
Installing phpdocumentor/type-resolver (1.3.0): Loading from cache
Installing phpdocumentor/reflection-docblock (5.2.1): Loading from cache
Installing psr/log (1.1.3): Loading from cache
Installing symfony/polyfill-php73 (v1.18.1): Loading from cache
Installing symfony/http-foundation (v5.1.5): Loading from cache
Installing psr/event-dispatcher (1.0.0): Loading from cache
Installing symfony/event-dispatcher-contracts (v2.2.0): Loading from cache
Installing symfony/event-dispatcher (v5.1.5): Loading from cache
Installing symfony/error-handler (v5.1.5): Loading from cache
Installing symfony/http-kernel (v5.1.5): Loading from cache
Installing symfony/finder (v5.1.5): Loading from cache
Installing psr/container (1.0.0): Loading from cache
Installing symfony/service-contracts (v2.2.0): Loading from cache
Installing symfony/console (v5.1.5): Loading from cache
Installing symfony/polyfill-iconv (v1.18.1): Loading from cache
Installing doctrine/lexer (1.2.1): Loading from cache
Installing egulias/email-validator (2.1.20): Loading from cache
Installing swiftmailer/swiftmailer (v6.2.3): Loading from cache
Installing brick/math (0.9.1): Loading from cache
Installing ramsey/collection (1.1.1): Loading from cache
Installing ramsey/uuid (4.1.1): Loading from cache
Installing psr/simple-cache (1.0.1): Loading from cache
Installing opis/closure (3.5.7): Loading from cache
Installing symfony/translation-contracts (v2.2.0): Loading from cache
Installing symfony/translation (v5.1.5): Loading from cache
Installing nesbot/carbon (2.39.2): Loading from cache
Installing monolog/monolog (2.1.1): Loading from cache
Installing league/mime-type-detection (1.4.0): Loading from cache
Installing league/flysystem (1.1.3): Loading from cache
Installing league/commonmark (1.5.4): Loading from cache
Installing dragonmantank/cron-expression (3.0.1): Loading from cache
Installing doctrine/inflector (2.0.3): Loading from cache
Installing laravel/framework (v8.1.0): Loading from cache
Installing fideloper/proxy (4.4.0): Loading from cache
Installing asm89/stack-cors (v2.0.1): Loading from cache
Installing fruitcake/laravel-cors (v2.0.2): Loading from cache
Installing psr/http-message (1.0.1): Loading from cache
Installing psr/http-client (1.0.1): Loading from cache
Installing ralouphie/getallheaders (3.0.3): Loading from cache
Installing guzzlehttp/psr7 (1.6.1): Loading from cache
Installing guzzlehttp/promises (v1.3.1): Loading from cache
Installing guzzlehttp/guzzle (7.0.1): Loading from cache
Failed to execute unzip -qq
'/home/suraj/Documents/blog/vendor/guzzlehttp/guzzle/1bba4d447795efc234ccc89b858ab8a1' -d
'/home/suraj/Documents/blog/vendor/composer/44c036a4'
[/home/suraj/Documents/blog/vendor/guzzlehttp/guzzle/1bba4d447795efc234ccc89b858ab8a1]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of
/home/suraj/Documents/blog/vendor/guzzlehttp/guzzle/1bba4d447795efc234ccc89b858ab8a1 or
/home/suraj/Documents/blog/vendor/guzzlehttp/guzzle/1bba4d447795efc234ccc89b858ab8a1.zip,
and cannot find
/home/suraj/Documents/blog/vendor/guzzlehttp/guzzle/1bba4d447795efc234ccc89b858ab8a1.ZIP,
period.
The archive may contain identical file names with different capitalization (which fails on
case insensitive filesystems)
Unzip with unzip command failed, falling back to ZipArchive class
Installing dnoegel/php-xdg-base-dir (v0.1.1): Loading from cache
Installing nikic/php-parser (v4.9.1): Loading from cache
Installing psy/psysh (v0.10.4): Loading from cache
Installing laravel/tinker (v2.4.2): Loading from cache
Installing scrivo/highlight.php (v9.18.1.2): Loading from cache
Installing filp/whoops (2.7.3): Loading from cache
Installing facade/ignition-contracts (1.0.1): Loading from cache
Installing facade/flare-client-php (1.3.5): Loading from cache
Installing facade/ignition (2.3.7): Loading from cache
Installing fzaninotto/faker (v1.9.1): Loading from cache
Installing hamcrest/hamcrest-php (v2.0.1): Loading from cache
Installing mockery/mockery (1.4.2): Loading from cache
Installing nunomaduro/collision (v5.0.2): Loading from cache
Installing sebastian/version (3.0.1): Loading from cache
Installing sebastian/type (2.2.1): Loading from cache
Installing sebastian/resource-operations (3.0.2): Loading from cache
Installing sebastian/recursion-context (4.0.2): Loading from cache
Installing sebastian/object-reflector (2.0.2): Loading from cache
Installing sebastian/object-enumerator (4.0.2): Loading from cache
Installing sebastian/global-state (5.0.0): Loading from cache
Installing sebastian/exporter (4.0.2): Loading from cache
Installing sebastian/environment (5.1.2): Loading from cache
Installing sebastian/diff (4.0.2): Loading from cache
Installing sebastian/comparator (4.0.3): Loading from cache
Installing sebastian/code-unit (1.0.5): Loading from cache
Installing sebastian/cli-parser (1.0.0): Loading from cache
Installing phpunit/php-timer (5.0.1): Loading from cache
Installing phpunit/php-text-template (2.0.2): Loading from cache
Installing phpunit/php-invoker (3.1.0): Loading from cache
Installing phpunit/php-file-iterator (3.0.4): Loading from cache
Installing sebastian/complexity (2.0.0): Loading from cache
Installing sebastian/lines-of-code (1.0.0): Loading from cache
Installing theseer/tokenizer (1.2.0): Loading from cache
Installing sebastian/code-unit-reverse-lookup (2.0.2): Loading from cache
Installing phpunit/php-code-coverage (9.1.8): Loading from cache
Installing doctrine/instantiator (1.3.1): Loading from cache
Installing phpspec/prophecy (1.11.1): Loading from cache
Installing phar-io/version (3.0.2): Loading from cache
Installing phar-io/manifest (2.0.1): Loading from cache
Installing myclabs/deep-copy (1.10.1): Loading from cache
Installing phpunit/phpunit (9.3.9): Loading from cache
symfony/routing suggests installing symfony/config (For using the all-in-one router or any
loader)
Symfony/routing suggests installing symfony/yaml (For using the YAML loader)
symfony/routing suggests installing symfony/expression-language (For using expression
matching)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that
can be used to generate random bytes.)
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/http-kernel suggests installing symfony/browser-kit
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/dependency-injection
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/lock
swiftmailer/swiftmailer suggests installing true/punycode (Needed to support
internationalized email addresses, if ext-intl is not installed)
ramsey/uuid suggests installing ext-gmp (Enables faster math with arbitrary-precision
integers using GMP.)
ramsey/uuid suggests installing ext-uuid (Enables the use of PeclUuidTimeGenerator and
PeclUuidRandomGenerator.)
ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as
Doctrine field type.)
ramsey/uuid suggests installing paragonie/random-lib (Provides RandomLib for use with the
RandomLibAdapter)
symfony/translation suggests installing symfony/config
symfony/translation suggests installing symfony/yaml
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a
GrayLog2 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 elasticsearch/elasticsearch (Allow sending log messages
to an Elasticsearch server via official client)
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-mongodb (Allow sending log messages to a MongoDB
server (via driver))
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB
server (via library))
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)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to
use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace
Cloud Files)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure
Blob storage)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV
storage)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3
storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3
storage with AWS SDK v3)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox
storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use
Dropbox storage for PHP 5 applications)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter
decorator for metadata caching)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server
storage via phpseclib)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use
ZipArchive adapter)
laravel/framework suggests installing ext-memcached (Required to use the memcache cache
driver.)
laravel/framework suggests installing ext-redis (Required to use the Redis cache and queue
drivers (^4.0|^5.0).)
laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver,
DynamoDb failed job storage and SES mail driver (^3.0).)
laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop
SQLite columns (^2.6).)
laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the
Flysystem S3 driver (^1.0).)
laravel/framework suggests installing league/flysystem-cached-adapter (Required to use the
Flysystem cache (^1.0).)
laravel/framework suggests installing league/flysystem-sftp (Required to use the Flysystem
SFTP driver (^1.0).)
laravel/framework suggests installing nyholm/psr7 (Required to use PSR-7 bridging features
(^1.2).)
laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue
driver (^4.0).)
laravel/framework suggests installing predis/predis (Required to use the predis connector
(^1.1.2).)
laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher
broadcast driver (^4.0).)
laravel/framework suggests installing symfony/cache (Required to PSR-6 cache bridge (^5.1).)
laravel/framework suggests installing symfony/filesystem (Required to enable support for
relative symbolic links (^5.1).)
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to use PSR-7
bridging features (^2.0).)
laravel/framework suggests installing wildbit/swiftmailer-postmark (Required to use Postmark
mail driver (^3.0).)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7
responses)
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.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want
this if your PHP install doesn't already support readline or libedit.)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
facade/ignition suggests installing laravel/telescope (^3.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-pcov (*)
phpunit/php-code-coverage suggests installing ext-xdebug (*)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
Script Illuminate\Foundation\ComposerScripts::postAutoloadDump handling the post-autoload-
dump event terminated with an exception
[ErrorException]
require(/home/suraj/Documents/blog/vendor/composer/../guzzlehttp/guzzle/src
/functions_include.php): failed to open stream: No such file or directory
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository
REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--
ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]
I used this and It works for me.
composer clear-cache
Is there any way to know what packages will/will not be autoloaded when using the --no-dev flag?
I have inherited some code that uses composer and Im unsure what packages are included in the production build and what are only included in the dev build.
Since doing composer dump-autoload --no-dev gives me errors regarding missing classes I suspect that some packages are flagged as dev-only when they should not and I'm trying to track those down.
I havent found anything in the composer docs to help me doing this.
The easiest way to check which packages are dev-only is to run composer install (this will install all dependencies, including dev-only) and then composer install --no-dev (this will remove dev-only dependencies). Last command will give you list of removed dependencies - these are packages not available in production builds, you should not rely on them (or move them to require section in your composer.json).
Example:
$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 56 installs, 0 updates, 0 removals
- Installing yiisoft/yii2-composer (2.0.7): Loading from cache
- Installing bower-asset/jquery (3.3.1): Loading from cache
- Installing bower-asset/bootstrap (v3.4.1): Loading from cache
- Installing bower-asset/inputmask (3.3.11): Loading from cache
- Installing bower-asset/punycode (v1.3.2): Loading from cache
- Installing bower-asset/yii2-pjax (2.0.7.1): Loading from cache
- Installing cebe/markdown (1.2.1): Loading from cache
- Installing ezyang/htmlpurifier (v4.10.0): Loading from cache
- Installing yiisoft/yii2 (2.0.17): Loading from cache
- Installing swiftmailer/swiftmailer (v5.4.12): Loading from cache
- Installing yiisoft/yii2-swiftmailer (2.0.7): Loading from cache
- Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
- Installing symfony/yaml (v2.8.49): Loading from cache
- Installing symfony/finder (v2.8.49): Loading from cache
- Installing symfony/event-dispatcher (v2.8.49): Loading from cache
- Installing symfony/polyfill-mbstring (v1.11.0): Loading from cache
- Installing symfony/dom-crawler (v2.8.49): Loading from cache
- Installing symfony/css-selector (v2.8.49): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v2.8.49): Loading from cache
- Installing symfony/console (v2.8.49): Loading from cache
- Installing symfony/browser-kit (v2.8.49): 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 sebastian/recursion-context (1.0.5): Loading from cache
- Installing sebastian/exporter (1.2.2): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing doctrine/instantiator (1.0.5): Loading from cache
- Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache
- Installing codeception/stub (1.0.4): Loading from cache
- Installing sebastian/diff (1.4.3): Loading from cache
- Installing sebastian/comparator (1.2.4): Loading from cache
- Installing sebastian/version (1.0.6): Loading from cache
- Installing sebastian/global-state (1.1.1): Loading from cache
- Installing sebastian/environment (1.3.8): Loading from cache
- Installing phpunit/php-timer (1.0.9): Loading from cache
- Installing phpunit/php-file-iterator (1.4.5): Loading from cache
- Installing phpunit/php-token-stream (1.4.12): Loading from cache
- Installing phpunit/php-code-coverage (2.2.4): Loading from cache
- Installing phpdocumentor/reflection-docblock (2.0.5): Loading from cache
- Installing phpspec/prophecy (1.8.0): Loading from cache
- Installing phpunit/phpunit (4.8.36): Loading from cache
- Installing codeception/phpunit-wrapper (6.0.10): Loading from cache
- Installing behat/gherkin (v4.6.0): Loading from cache
- Installing codeception/base (2.4.1): Loading from cache
- Installing myclabs/deep-copy (1.6.1): Loading from cache
- Installing codeception/specify (0.4.6): Loading from cache
- Installing codeception/verify (0.3.3): Loading from cache
- Installing yiisoft/yii2-bootstrap (2.0.9): Loading from cache
- Installing yiisoft/yii2-debug (2.0.14): Loading from cache
- Installing fzaninotto/faker (v1.8.0): Loading from cache
- Installing yiisoft/yii2-faker (2.0.4): Loading from cache
- Installing phpspec/php-diff (v1.1.0): Loading from cache
- Installing bower-asset/typeahead.js (v0.11.1): Loading from cache
- Installing yiisoft/yii2-gii (2.0.8): Loading from cache
Generating autoload files
And then list of dev-only dependencies:
$ composer install --no-dev
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 44 removals
- Removing yiisoft/yii2-gii (2.0.8)
- Removing yiisoft/yii2-faker (2.0.4)
- Removing yiisoft/yii2-debug (2.0.14)
- Removing symfony/yaml (v2.8.49)
- Removing symfony/polyfill-mbstring (v1.11.0)
- Removing symfony/polyfill-ctype (v1.11.0)
- Removing symfony/finder (v2.8.49)
- Removing symfony/event-dispatcher (v2.8.49)
- Removing symfony/dom-crawler (v2.8.49)
- Removing symfony/debug (v2.8.49)
- Removing symfony/css-selector (v2.8.49)
- Removing symfony/console (v2.8.49)
- Removing symfony/browser-kit (v2.8.49)
- Removing sebastian/version (1.0.6)
- Removing sebastian/recursion-context (1.0.5)
- Removing sebastian/global-state (1.1.1)
- Removing sebastian/exporter (1.2.2)
- Removing sebastian/environment (1.3.8)
- Removing sebastian/diff (1.4.3)
- Removing sebastian/comparator (1.2.4)
- Removing ralouphie/getallheaders (2.0.5)
- Removing psr/log (1.1.0)
- Removing psr/http-message (1.0.1)
- Removing phpunit/phpunit-mock-objects (2.3.8)
- Removing phpunit/phpunit (4.8.36)
- Removing phpunit/php-token-stream (1.4.12)
- Removing phpunit/php-timer (1.0.9)
- Removing phpunit/php-text-template (1.2.1)
- Removing phpunit/php-file-iterator (1.4.5)
- Removing phpunit/php-code-coverage (2.2.4)
- Removing phpspec/prophecy (1.8.0)
- Removing phpspec/php-diff (v1.1.0)
- Removing phpdocumentor/reflection-docblock (2.0.5)
- Removing myclabs/deep-copy (1.6.1)
- Removing guzzlehttp/psr7 (1.5.2)
- Removing fzaninotto/faker (v1.8.0)
- Removing doctrine/instantiator (1.0.5)
- Removing codeception/verify (0.3.3)
- Removing codeception/stub (1.0.4)
- Removing codeception/specify (0.4.6)
- Removing codeception/phpunit-wrapper (6.0.10)
- Removing codeception/base (2.4.1)
- Removing bower-asset/typeahead.js (v0.11.1)
- Removing behat/gherkin (v4.6.0)
Generating autoload files
There is also a maglnet/composer-require-checker which may be useful for detecting usage of libraries not listed in require section.
Basically, any package (and its dependencies) in require-dev section of your composer.json file will not be autoloaded when you use composer dump-autoload --no-dev. Sadly, I don't think there's a command to show those packages together with their dependencies as a single list.
What you can do is try moving each of the packages from require-dev section to require, reruning composer update and composer dump-autoload --no-dev to see when your error disappears.
I just discovered that you can show all root packages using composer show -s:
name : roots/bedrock
descrip. : WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure
keywords : bedrock, roots, wordpress, stack, composer, vagrant, wp
versions : * dev-update-and-apply-aq-changes
type : project
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : https://roots.io/bedrock/
source : [] 412b5d6779300e49762ed2402d0f87ca50475f2f
dist : [] 412b5d6779300e49762ed2402d0f87ca50475f2f
path :
names : roots/bedrock
support
issues : https://github.com/roots/bedrock/issues
forum : https://discourse.roots.io/category/bedrock
requires
php >=7.0
composer/installers ^1.11
oscarotero/env ^1.2.0
roots/wordpress 5.7.2
roots/wp-password-bcrypt 1.0.0
roots/wp-config 1.0.0
advanced-custom-fields/advanced-custom-fields-pro *
wpackagist-plugin/wordpress-seo ^16.1
requires (dev)
squizlabs/php_codesniffer ^3.0.2
dealerdirect/phpcodesniffer-composer-installer *
wp-coding-standards/wpcs *
wpackagist-plugin/query-monitor ^3.7
roave/security-advisories dev-master
And then you can cut out the requires (dev) section using composer show -s | sed -n '/requires (dev)$/,/^$/p'
requires (dev)
squizlabs/php_codesniffer ^3.0.2
dealerdirect/phpcodesniffer-composer-installer *
wp-coding-standards/wpcs *
wpackagist-plugin/query-monitor ^3.7
roave/security-advisories dev-master
And then you can get rid of the title using composer show -s | sed -n '/requires (dev)$/,/^$/p' | grep -v 'requires (dev)'
squizlabs/php_codesniffer ^3.0.2
dealerdirect/phpcodesniffer-composer-installer *
wp-coding-standards/wpcs *
wpackagist-plugin/query-monitor ^3.7
roave/security-advisories dev-master
And then you can get rid of the version using composer show -s | sed -n '/requires (dev)$/,/^$/p' | grep -v 'requires (dev)' | cut -d ' ' -f1
squizlabs/php_codesniffer
dealerdirect/phpcodesniffer-composer-installer
wp-coding-standards/wpcs
wpackagist-plugin/query-monitor
roave/security-advisories
i'm working already with symfony 3, I've create a lot of project with it, so now i'm trying to create a project with symfony 4, but i can't when i type this command :
composer create-project symfony/skeleton my-project-symf-4
the project is created successfully, but the problem that is created with this version 3.4 instead of 4.2,
Installing symfony/skeleton (v3.4.22.1)
- Installing symfony/skeleton (v3.4.22.1): Downloading (100%)
Created project in my-project-symf-4
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 22 installs, 0 updates, 0 removals
- Installing symfony/flex (v1.1.8): Downloading (100%)
Prefetching 21 packages
- Downloading (100%)
- Installing psr/cache (1.0.1): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v3.4.22): Loading from cache
- Installing symfony/console (v3.4.22): Loading from cache
- Installing symfony/dotenv (v3.4.22): Loading from cache
- Installing symfony/routing (v3.4.22): Loading from cache
- Installing symfony/http-foundation (v3.4.22): Loading from cache
- Installing symfony/event-dispatcher (v3.4.22): Loading from cache
- Installing symfony/http-kernel (v3.4.22): Loading from cache
- Installing symfony/finder (v3.4.22): Loading from cache
- Installing symfony/filesystem (v3.4.22): Loading from cache
- Installing symfony/dependency-injection (v3.4.22): Loading from cache
- Installing symfony/config (v3.4.22): Loading from cache
- Installing symfony/class-loader (v3.4.22): Loading from cache
- Installing symfony/polyfill-apcu (v1.10.0): Loading from cache
- Installing symfony/cache (v3.4.22): Loading from cache
- Installing symfony/framework-bundle (v3.4.22): Loading from cache
- Installing symfony/yaml (v3.4.22): Loading from cache
Generating autoload files
So as you can see the composer load all packages from cache.
I've try to clear composer cache like this:
$ composer clearcache
but without result, the problem still exist.
My PHP Version is 7.3.1
Can anyone help me to resolve that problem?
Try to pass the symfony version (4.2 for example) like that:
composer create-project symfony/skeleton:4.2 my-project-symf-4
Hope this helps!
If you installed symfony CLI in your system then you just run the below command with specifying version number
For Example to create a Symfony project with 4.4 version run following command
symfony new my_project_name --version=4.4
I'm installing a fresh Laravel 5.7 with this command:
composer global require laravel/installer
~/.composer/vendor/bin/laravel new plugin-test3
here is the full log:
Crafting application...
You should verify that the "storage" and "bootstrap/cache" directories are writable.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 86 installs, 0 updates, 0 removals
- Installing vlucas/phpdotenv (v2.5.1): Loading from cache
- Installing symfony/css-selector (v4.2.1): Loading from cache
- Installing tijsverkoyen/css-to-inline-styles (2.2.1): Loading from cache
- Installing symfony/polyfill-php72 (v1.10.0): Loading from cache
- Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache
- Installing symfony/var-dumper (v4.2.1): Loading from cache
- Installing symfony/routing (v4.2.1): Loading from cache
- Installing symfony/process (v4.2.1): Loading from cache
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
- Installing symfony/http-foundation (v4.2.1): Loading from cache
- Installing symfony/contracts (v1.0.2): Loading from cache
- Installing symfony/event-dispatcher (v4.2.1): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v4.2.1): Loading from cache
- Installing symfony/http-kernel (v4.2.1): Loading from cache
- Installing symfony/finder (v4.2.1): Loading from cache
- Installing symfony/console (v4.2.1): Loading from cache
- Installing doctrine/lexer (v1.0.1): Loading from cache
- Installing egulias/email-validator (2.1.7): Loading from cache
- Installing swiftmailer/swiftmailer (v6.1.3): Loading from cache
- Installing paragonie/random_compat (v9.99.99): Loading from cache
- Installing ramsey/uuid (3.8.0): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing opis/closure (3.1.2): Loading from cache
- Installing symfony/translation (v4.2.1): Loading from cache
- Installing nesbot/carbon (1.36.1): Loading from cache
- Installing monolog/monolog (1.24.0): Loading from cache
- Installing league/flysystem (1.0.49): Loading from cache
- Installing erusev/parsedown (1.7.1): Loading from cache
- Installing dragonmantank/cron-expression (v2.2.0): Loading from cache
- Installing doctrine/inflector (v1.3.0): 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 laravel/slack-notification-channel (v1.0.3): Loading from cache
- Installing laravel/framework (v5.7.19): Loading from cache
- Installing lcobucci/jwt (3.2.5): Loading from cache
- Installing php-http/promise (v1.0.0): Loading from cache
- Installing php-http/httplug (v1.1.0): Loading from cache
- Installing php-http/guzzle6-adapter (v1.1.1): Loading from cache
- Installing zendframework/zend-diactoros (1.8.6): Loading from cache
- Installing nexmo/client (1.6.0): Loading from cache
- Installing laravel/nexmo-notification-channel (v1.0.1): Loading from cache
- Installing fideloper/proxy (4.0.0): Loading from cache
- Installing nikic/php-parser (v4.1.0): Loading from cache
- Installing jakub-onderka/php-console-color (v0.2): Loading from cache
- Installing jakub-onderka/php-console-highlighter (v0.4): Loading from cache
- Installing dnoegel/php-xdg-base-dir (0.1): Loading from cache
- Installing psy/psysh (v0.9.9): Loading from cache
- Installing laravel/tinker (v1.0.8): Loading from cache
- Installing beyondcode/laravel-dump-server (1.2.2): Loading from cache
- Installing fzaninotto/faker (v1.8.0): Loading from cache
- Installing hamcrest/hamcrest-php (v2.0.0): Loading from cache
- Installing mockery/mockery (1.2.0): Loading from cache
- Installing filp/whoops (2.3.1): Loading from cache
- Installing nunomaduro/collision (v2.1.1): Loading from cache
- Installing sebastian/version (2.0.1): Loading from cache
- Installing sebastian/resource-operations (2.0.1): Loading from cache
- Installing sebastian/object-reflector (1.1.1): Loading from cache
- Installing sebastian/recursion-context (3.0.0): 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 doctrine/instantiator (1.1.0): Loading from cache
- Installing webmozart/assert (1.3.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 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.1): Loading from cache
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/dependency-injection (For loading routes from a service)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing symfony/yaml (For using the YAML loader)
symfony/contracts suggests installing psr/cache (When using the Cache contracts)
symfony/contracts suggests installing symfony/cache-contracts-implementation
symfony/contracts suggests installing symfony/service-contracts-implementation
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/http-kernel suggests installing symfony/browser-kit
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/dependency-injection
symfony/console suggests installing symfony/lock
swiftmailer/swiftmailer suggests installing true/punycode (Needed to support internationalized email addresses, if ext-intl is not installed)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
ramsey/uuid suggests installing ircmaxell/random-lib (Provides RandomLib for use with the RandomLibAdapter)
ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator)
ramsey/uuid suggests installing ext-uuid (Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator)
ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).)
ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.)
ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid)
symfony/translation suggests installing symfony/config
symfony/translation suggests installing symfony/yaml
nesbot/carbon suggests installing friendsofphp/php-cs-fixer (Needed for the `composer phpcs` command. Allow to automatically fix code style.)
nesbot/carbon suggests installing phpstan/phpstan (Needed for the `composer phpstan` command. Allow to detect potential errors.)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
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 graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)
laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (^3.0).)
laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (^2.6).)
laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (^1.0).)
laravel/framework suggests installing league/flysystem-cached-adapter (Required to use the Flysystem cache (^1.0).)
laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (^1.0).)
laravel/framework suggests installing league/flysystem-sftp (Required to use the Flysystem SFTP driver (^1.0).)
laravel/framework suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).)
laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (^3.0).)
laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (^1.0).)
laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (^3.0).)
laravel/framework suggests installing symfony/dom-crawler (Required to use most of the crawler integration testing tools (^4.1).)
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to psr7 bridging features (^1.0).)
lcobucci/jwt suggests installing mdanter/ecc (Required to use Elliptic Curves based algorithms.)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating optimized autoload files
> #php -r "file_exists('.env') || copy('.env.example', '.env');"
> #php artisan key:generate --ansi
PHP Warning: Uncaught ErrorException: require(/Users/julien/Documents/Projets/plugin-test3/routes/api.php): failed to open stream: No such file or directory in /Users/julien/Documents/Projets/plugin-test3/vendor/laravel/framework/src/Illuminate/Routing/Router.php:417
Stack trace:
#0 /Users/julien/Documents/Projets/plugin-test3/vendor/laravel/framework/src/Illuminate/Routing/Router.php(417): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'require(/Users/...', '/Users/julien/D...', 417, Array)
#1 /Users/julien/Documents/Projets/plugin-test3/vendor/laravel/framework/src/Illuminate/Routing/Router.php(417): require()
#2 /Users/julien/Documents/Projets/plugin-test3/vendor/laravel/framework/src/Illuminate/Routing/Router.php(373): Illuminate\Routing\Router->loadRoutes('/Users/julien/D...')
#3 /Users/julien/Documents/Projets/plugin-test3/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php(121): Illuminate\Routing\Router->group(Array, '/Users/julien/D...')
#4 /Users/julien/Documents/Projets/plugin-t in /Users/julien/Documents/Projets/plugin-test3/vendor/laravel/framework/src/Illuminate/Routing/Router.php on line 417
PHP Fatal error: Illuminate\Routing\Router::loadRoutes(): Failed opening required '/Users/julien/Documents/Projets/plugin-test3/routes/api.php' (include_path='.:/usr/local/Cellar/php/7.2.8/share/php/pear') in /Users/julien/Documents/Projets/plugin-test3/vendor/laravel/framework/src/Illuminate/Routing/Router.php on line 417
In Router.php line 417:
Illuminate\Routing\Router::loadRoutes(): Failed opening required '/Users/ju
lien/Documents/Projets/plugin-test3/routes/api.php' (include_path='.:/usr/l
ocal/Cellar/php/7.2.8/share/php/pear')
Script #php artisan key:generate --ansi handling the post-create-project-cmd event returned with error code 255
Application ready! Build something amazing.
I have the latest version of laravel installer:
~/.composer/vendor/bin/laravel --version
--> Laravel Installer 2.0.1
I also have php7.2
$ php --version
PHP 7.2.8 (cli) (built: Jul 19 2018 12:15:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.8, Copyright (c) 1999-2018, by Zend Technologies
What can I do about that?
I'm using the acelaya/zf2-acqrcode package (v0.2.0) It requires "endroid/qrcode": ">=1.2.0", (meaning everything higher than or equal to 1.2.0)
Currently the latest version of the "endroid/qrcode" package = v3.2.12
The acelaya/zf2-acqrcode package (v0.2.0) uses a function that doesn't exist anymore in endroid/qrcode versions > 1.9.3
Is there any way I can tell composer not to install a version of the endroid/qrcode package higher than 1.9.3?
Yes you can restrict the package versions by using the ~ operator in composer.json. More Information on that can be found Here
Hope this helps.
Use the following to lock the endroid/qrcode dependency to 1.9.3. Sub dependencies will adhere to this and honour the fact you've locked acelaya/zf2-acqrcode.
Note: this will only fail when another dependency requires >1.9.3 of endroid/qrcode
{
"require": {
"endroid/qrcode": "1.9.3",
"acelaya/zf2-acqrcode": "^1.0"
}
}
Run the command following command:
/path/to/composer.phar require endroid/qrcode:1.9.3
Here's the output of the above required dependencies:
$ composer install
Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 18 installs, 0 updates, 0 removals
- Installing zendframework/zend-stdlib (3.2.0): Loading from cache
- Installing zendframework/zend-loader (2.6.0): Loading from cache
- Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
- Installing zendframework/zend-view (2.10.0): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing container-interop/container-interop (1.2.0): Loading from cache
- Installing zendframework/zend-servicemanager (3.3.2): Loading from cache
- Installing zendframework/zend-validator (2.10.2): Loading from cache
- Installing zendframework/zend-escaper (2.6.0): Loading from cache
- Installing zendframework/zend-uri (2.6.1): Loading from cache
- Installing zendframework/zend-http (2.8.0): Loading from cache
- Installing zendframework/zend-router (3.0.2): Loading from cache
- Installing zendframework/zend-config (3.2.0): Loading from cache
- Installing zendframework/zend-modulemanager (2.8.2): Loading from cache
- Installing zendframework/zend-mvc (3.1.1): Loading from cache
- Installing symfony/options-resolver (v3.4.11): Loading from cache
- Installing endroid/qrcode (1.9.3): Loading from cache
- Installing acelaya/zf2-acqrcode (v1.0.0): Loading from cache