Skip to content

simple multiplayer CLI checkers implementation for educational purposes

License

Notifications You must be signed in to change notification settings

vandr0iy/php8-checkers

Repository files navigation

PHP 8 Project Template

This is a template of PHP 8 project. You can use it to start with your own PHP project. Inside this template you will find:

  • composer file with basic libraries defined,
  • configuration file for php-cs-fixer,
  • configuration file for PHPUnit,
  • configuration file for Kahlan,
  • code samples that you can start with.

Before you start

This template use Composer for dependency management. To download all dependent code you need call this command:

composer install

Or if you want tu update (outdated packages):

composer update

Structure

  • "/src" - your code goes here
  • "/test" - here yo will put all of your phpunit tests
  • "/spec" - and this is a place for kahlan spec files

Directories "vendor" and "docs" are technical ones and you don't need to make any changes in them.

Remember to change your namespace. This project template use "WeBee" namespace.

How to run tools

PHPUnit

To run all tests execute bellow command:

./vendor/bin/phpunit

According to template configuration this command will also generate coverage report. It will be placed in "docs/coverage-report" directory.

WARNING: Code coverage needs to be enabled in php.ini by setting 'xdebug.mode' to 'coverage'.

Kahlan

To run all spec files execute this command:

./vendor/bin/kahlan

php-cs-fixer

To fix all code standards violations run below command:

./vendor/bin/php-cs-fixer fix

If you only want to see all violations just run this command:

./vendor/bin/php-cs-fixer --dry-run --diff fix

External sources

Documenting the code

Markdown to be used to write README.md (and not only)

PHP Coding standards

PHP Unit testing

Dependency management

Install nix + direnv

  1. Download Nix package manager: https://nixos.org/download.html
  2. Turn on flakes support: https://nixos.wiki/wiki/Flakes#Non-NixOS
  3. Install nix-direnv: nix-env -f '<nixpkgs>' -iA nix-direnv
  4. Start a new shell, go to project root and run: direnv allow

Set up a new repo

Assuming here you've got installed nix, direnv, and nix-direnv.

USER=<your-github-username>
NAME=<your-new-repo-name-here>
git clone [email protected]:volodhrim/php8-template.git "${NAME}"
direnv allow

git remote rename origin old-origin
git remote add origin "[email protected]:${USER}/${NAME}.git"
git branch -M master
git push -u origin master

Few nifty things

TODO: move this thing to use the devshell.toml file TODO: call this origin something like devtemplate and set a command to pull regularly

Big thanks to the guy I've originally stole this thing from.

About

simple multiplayer CLI checkers implementation for educational purposes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published