Skip to content

PHP packages used

Sylvain Martin edited this page Dec 22, 2022 · 1 revision

PHP packages used and Composer

Composer commands

To initially install the defined dependencies for your project, you should run the update command.

php composer.phar update

f there is already a composer.lock file in the project folder, it means either you ran the update command before, or someone else on the project ran the update command and committed the composer.lock file to the project (which is good).

Either way, running install when a composer.lock file is present resolves and installs all dependencies that you listed in composer.json, but Composer uses the exact versions listed in composer.lock to ensure that the package versions are consistent for everyone working on your project. As a result you will have all dependencies requested by your composer.json file, but they may not all be at the very latest available versions (some of the dependencies listed in the composer.lock file may have released newer versions since the file was created). This is by design, it ensures that your project does not break because of unexpected changes in dependencies.

So after fetching new changes from your VCS repository it is recommended to run a Composer install to make sure the vendor directory is up in sync with your composer.lock file.

php composer.phar install

To list the globally installed composer packages:

php composer.phar show -i

Assetic

Assetic is an asset management framework for PHP. it is to manage static assets (like js, and css files). to 'dump' them (meaning to install them at the right place). one should execute the following command:

# --env=prod --no-debug for prod
php bin/console assetic:dump --env=prod --no-debug

to install new assets from the bundles web assets (under a public directory ``src/AppBundle/Resources/public

php bin/console assets:install                           

PHP packages for development

ClockMock

ClockMock provides a way for mocking the current timestamp used by PHP for \DateTime(Immutable) objects and date/time related functions. It requires the uopz extension (version >= 6.1.1).

[!warning] This library is meant for development and testing only. It does not aim to propose a clock service to be used in production code, as we believe that you shouldn't need to do that when your only purpose is to mock the current time in testing code.

You can install the library using Composer. Run the following command to install the latest version from Packagist:

# with system composer
composer require --dev slope-it/clock-mock 

# or with local composer
php composer.phar require --dev slope-it/clock-mock 

Note that, as this is not a tool intended for production, it should be required only for development (--dev flag).

if a error appear in composer it can be link to the the uopz PHP extension, so one can disactivate it in the php.ini by commenting the line extension=uopz and use the use the ignore-platform-req`` flag.

php composer.phar require --dev slope-it/clock-mock  --ignore-platform-req=ext-uopz