Skip to content

Instantly share code, notes, and snippets.

@szabacsik
Last active September 3, 2021 14:30
Show Gist options
  • Save szabacsik/3eeb37ee4bf6db14ccb29871576abadb to your computer and use it in GitHub Desktop.
Save szabacsik/3eeb37ee4bf6db14ccb29871576abadb to your computer and use it in GitHub Desktop.
Composer
{
    "type": "project",
    "license": "proprietary",
    "autoload":
    {
        "psr-4":
        {
            "App\\": "src/"
        }
    },
    "autoload-dev":
    {
        "psr-4":
        {
            "App\\Tests\\": "tests/"
        }
    },
    "require":
    {
        "php": "^7.2 || ^8.0",
        "vlucas/phpdotenv": "*",
        "league/route": "*",
        "twig/twig": "*",
        "monolog/monolog": "*"
    },
    "require-dev":
    {
        "phpunit/phpunit": "*",
        "vimeo/psalm": "*",
        "phpstan/phpstan": "*",
        "phpstan/phpstan-phpunit": "*",
        "squizlabs/php_codesniffer": "*",
        "phing/phing": "*",
        "deployer/deployer": "*"
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "config":
    {
        "optimize-autoloader": true,
        "sort-packages": true
    },
    "scripts":
    {
        "validate-composer": "composer validate --no-check-all --strict",
        "phpcs": "phpcs --standard=PSR2 src",
        "phpstan": "phpstan analyse -l 4 --no-progress src",
        "phpunit": "phpunit --verbose --colors=always",
        "phpunit-coverage": "phpunit --verbose --colors=always --coverage-html build/coverage",
        "test":
        [
            "@phpcs",
            "@phpstan",
            "@phpunit"
        ]
    },
    "scripts-descriptions":
    {
        "validate-composer": "Validate the composer.json file",
        "phpcs": "Checks that the application code conforms to coding standard",
        "test": "Launches all the tests"
    }
}

https://blog.martinhujer.cz/have-you-tried-composer-scripts/

@szabacsik
Copy link
Author

https://stackoverflow.com/questions/23086204/composer-required-packages-with-differing-levels-of-minimum-stability

"minimum-stability": "dev",
"prefer-stable" : true

This basically means it will always use stable UNLESS there is no way to install a stable dependency, and therefore use dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment