https://github.com/exercism/php
Exercism exercises in PHP.
https://github.com/exercism/php
community-contributions-paused exercism-track
Last synced: about 1 year ago
JSON representation
Exercism exercises in PHP.
- Host: GitHub
- URL: https://github.com/exercism/php
- Owner: exercism
- License: mit
- Created: 2014-02-28T05:31:39.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T10:58:30.000Z (about 2 years ago)
- Last Synced: 2024-05-01T11:25:26.832Z (about 2 years ago)
- Topics: community-contributions-paused, exercism-track
- Language: PHP
- Homepage: https://exercism.org/tracks/php
- Size: 1.82 MB
- Stars: 136
- Watchers: 17
- Forks: 130
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Exercism PHP Track
Exercism exercises in PHP
Follow these instructions to contribute to the PHP track.
To solve the exercises, head to the [PHP track][exercism-track-home] and check the [documentation][exercism-track-installation].
## Install Dependencies
The following system dependencies are required:
- `composer`, as recommended in the [PHP track installation docs][exercism-track-installation-composer].
- [`bash` shell][gnu-bash].
- PHP V8.3+ CLI.
- An active Internet connection for installing required tools / composer packages.
Run the following command to get started with this project:
```shell
composer install # Required dependencies to develop this track
```
## Running Exercism resources management
`bin/configlet` is the official tool for managing Exercism language track repositories.
See [Building Exercism docs][exercism-configlet].
For convenience, you can use `composer configlet:fmt` to fix formatting issues in the Exercism track files.
This is included in `composer ci` to run the CI checks locally.
## Running Unit Test Suite
The tests are run with PHPUnit. A shell loop injecting `exemplar.php` is provided to ease testing.
Execute the following command to run the tests:
```shell
composer test:run
```
This is included in `composer ci` to run the CI checks locally.
### Run a specific test
If you want to run tests for one specific exercise, you can do it with following cli command.
```shell
composer test:run -- exercise-name
# e.g
composer test:run -- book-store
```
If you want to run all starting with let's say 'b' you can run
```shell
composer test:run -- "b*"
```
## Running Style Checker
This project uses a slightly [modified][local-file-phpcs-config] version of [PSR-12].
Use the following commands to apply code style:
```shell
composer lint:check # Checks the files against the code style rules
composer lint:fix # Automatically fix code style issues
```
The `lint:check` is included in `composer ci` to run the CI checks locally.
## Contributing
- Read the documentation at [Exercism][exercism-docs].
- Follow the [PSR-12] coding style (Exercisms PHP track uses a slightly [modified][local-file-phpcs-config] version of [PSR-12]).
- Run `composer ci` to run CI checks locally before pushing.
- CI is run on all pull requests, it must pass the required checks for merge.
- CI is running all tests on PHP 8.0 to PHP 8.2 for Linux, Windows and MacOS.
## Generating new practice exercises
Use `bin/configlet create --practice-exercise ` to create the exercism resources required.
This provides you with the directories and files in `exercises/practice/`.
Look into `tests.toml` for which test cases **not** to implement / generate and mark them with `include = false`.
Test generator MVP used like this:
```shell
composer -d contribution/generator install
contribution/generator/bin/console app:create-tests ''
composer lint:fix
```
[exercism-configlet]: https://exercism.org/docs/building/configlet
[exercism-docs]: https://exercism.org/docs
[exercism-track-home]: https://exercism.org/docs/tracks/php
[exercism-track-installation]: https://exercism.org/docs/tracks/php/installation
[exercism-track-installation-composer]: https://exercism.org/docs/tracks/php/installation#h-install-composer
[gnu-bash]: https://www.gnu.org/software/bash/
[local-file-phpcs-config]: phpcs.xml
[psr-12]: https://www.php-fig.org/psr/psr-12