Composer.json : le manifeste du développeur moderne

5 min de lecture

Et maintenant, présentation officielle de mon fichier composer.json (à la fin du billet). Oui, c’est ce fichier où on met tellement de trucs qu’on dirait un buffet à volonté : tu as pris trop de tout, tu peux plus bouger, ta ceinture va exploser comme ton bidou, mais tu regrettes rien.

Les indispensables, qu’on utilise même pas toujours

La sécurité, cette grande paranoïa moderne

Utilitaires à usage très, très spécifique

La galaxie Symfony : ces bundles qu’on ajoute sans réfléchir (et parce-que sinon c’est pas un projet Symfony)

La famille Twig (ou comment éviter PHP dans les vues)

Pour les vrais qui testent leur code (ou prétendent le faire)

Polyfills à outrance

On arrive à la fin

Ce fichier composer.json, c’est comme un gros sac à dos : t’y mets toute ta vie, ça pèse une tonne, mais si tu enlèves un truc, t’as l’impression qu’il te manque quelque chose d’essentiel.

L’intégralité du fichier en question :

{
    "type": "project",
    "license": "MIT",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=8.2",
        "ext-ctype": "*",
        "ext-dom": "*",
        "ext-iconv": "*",
        "ext-libxml": "*",
        "ext-simplexml": "*",
        "ext-xml": "*",
        "doctrine/doctrine-bundle": "^2.10.2",
        "doctrine/doctrine-migrations-bundle": "^3.2.4",
        "doctrine/orm": "^3.0.1",
        "easycorp/easyadmin-bundle": "^4.24",
        "endroid/qr-code": "^6.0",
        "ezyang/htmlpurifier": "^4.18",
        "gedmo/doctrine-extensions": "^3.18",
        "karser/karser-recaptcha3-bundle": "^0.2.1",
        "league/commonmark": "^2.6",
        "nelmio/security-bundle": "^3.4",
        "scheb/2fa-bundle": "^7.6",
        "scheb/2fa-totp": "^7.6",
        "symfony/asset": "^7.2",
        "symfony/asset-mapper": "^7.2",
        "symfony/config": "^7.2",
        "symfony/console": "^7.2",
        "symfony/dotenv": "^7.2",
        "symfony/expression-language": "^7.2",
        "symfony/filesystem": "^7.2",
        "symfony/flex": "*",
        "symfony/form": "^7.2",
        "symfony/framework-bundle": "^7.2",
        "symfony/lock": "^7.2",
        "symfony/monolog-bundle": "^3.8",
        "symfony/property-access": "^7.2",
        "symfony/property-info": "^7.2",
        "symfony/rate-limiter": "^7.2",
        "symfony/runtime": "^7.2",
        "symfony/security-bundle": "^7.2",
        "symfony/serializer": "^7.2",
        "symfony/twig-bundle": "^7.2",
        "symfony/ux-live-component": "^2.23",
        "symfony/ux-twig-component": "^2.22",
        "symfony/validator": "^7.2",
        "symfony/web-link": "^7.2",
        "symfony/yaml": "^7.2",
        "symfonycasts/tailwind-bundle": "^0.8.0",
        "twig/cache-extra": "*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/html-extra": "^3.20",
        "twig/intl-extra": "^3.20",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^4.0",
        "fakerphp/faker": "^1.24",
        "friendsofphp/php-cs-fixer": "^3.70",
        "phpstan/extension-installer": "^1.4",
        "phpstan/phpstan": "^2.1",
        "phpstan/phpstan-doctrine": "^2.0",
        "phpstan/phpstan-symfony": "^2.0",
        "phpunit/phpunit": "^12.0",
        "psalm/plugin-symfony": "^5.2",
        "rector/rector": "^2.0",
        "roave/security-advisories": "dev-latest",
        "symfony/browser-kit": "^7.2",
        "symfony/css-selector": "^7.2",
        "symfony/debug-bundle": "^7.2",
        "symfony/maker-bundle": "^1.51.1",
        "symfony/panther": "^2.2",
        "symfony/stopwatch": "^7.2",
        "symfony/web-profiler-bundle": "^7.2",
        "vimeo/psalm": "^6.8",
        "weirdan/doctrine-psalm-plugin": "^2.10"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "phpstan/extension-installer": true,
            "symfony/flex": true,
            "symfony/runtime": true
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*",
        "symfony/polyfill-php80": "*",
        "symfony/polyfill-php81": "*",
        "symfony/polyfill-php82": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install": "symfony-cmd",
            "importmap:install": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": true,
            "require": "^7.2",
            "docker": true
        }
    }
}

Confidentialité

Ce site utilise Umami pour analyser le trafic de manière anonyme. Acceptez-vous la collecte de données anonymes ?