Skip to content

Instantly share code, notes, and snippets.

@event15
Last active January 15, 2016 10:46
Show Gist options
  • Save event15/84e993fca49f449f15a4 to your computer and use it in GitHub Desktop.
Save event15/84e993fca49f449f15a4 to your computer and use it in GitHub Desktop.
Przygotowany plik composer.json oraz dodany do niego PHPSpec
{
"name": "root/katas",
"description": "Popularne Kata w PHP",
"type": "project",
"require" :{
"php": ">= 7.0"
},
"require-dev": {
"phpspec/phpspec": "^2.4"
},
"license": "MIT",
"authors": [
{
"name": "Marek Woś",
"email": "nie@podam.pl"
}
],
"config": {
"bin-dir": "bin/"
},
"autoload": {
"psr-4": {
"Kata\\": "src/Kata"
}
}
}
@efiku
Copy link

efiku commented Jan 14, 2016

W require nie wolno posiadać narzędzi służących do budowania / testowania aplikacji.
Od tego jest require-dev

composer require-dev phpspec/phpspec --dist

PSR-0 jest deprecated. PSR-4 używaj.

@efiku
Copy link

efiku commented Jan 15, 2016

{
    "name": "root/katas",
    "description": "App desc",
    "type": "project",
    "require" :{
        "php": ">= 7.0"
    },
    "require-dev": {
        "phpspec/phpspec": "^2.4",
        "fabpot/php-cs-fixer": "^1.11"
    },
    "license": "MIT",
    "authors": [
        {
            "name": "Marek Woś",
            "email": "nie@podam.pl"
        }
    ],
    "config": {
        "bin-dir": "bin/"
    },
    "autoload": {
        "psr-4": {
            "efiku\\": "src/"
        }
    }
}

IMHO lepszy config.
dzięki opcji bin-dir tworzy się nam katalog bin w projekcie gdzie mamy symlink do /vendor/phpspec[...]

@event15
Copy link
Author

event15 commented Jan 15, 2016

Approved.
Robiłem wpis o kata i TDD, więc uznałem, że composer to sprawa drugorzędna, jednak skoro to wpis o sztuce i rzemiośle, warto i o to zadbać.

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