-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[php][step_shotgun_surgery-01_base] Add base
- Loading branch information
Dani Santamaría
committed
Apr 8, 2021
1 parent
35aacd5
commit 51d21ef
Showing
24 changed files
with
2,841 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
examples/php/php-step_shotgun_surgery-01_base/.editorconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.php] | ||
indent_size = 4 | ||
indent_style = space | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor/ |
4 changes: 4 additions & 0 deletions
4
examples/php/php-step_shotgun_surgery-01_base/.scrutinizer.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build: | ||
environment: | ||
php: | ||
version: '7.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
:major: 1 | ||
:minor: 2 | ||
:patch: 1 | ||
:special: '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
language: php | ||
|
||
sudo: false | ||
|
||
php: | ||
- '7.2' | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
before_install: | ||
- stty cols 120 | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist | ||
|
||
script: | ||
- composer lint | ||
- composer style | ||
- composer phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2018 CodelyTV. https://codely.tv | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
126 changes: 126 additions & 0 deletions
126
examples/php/php-step_shotgun_surgery-01_base/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# PHP Bootstrap (base / project skeleton) | ||
|
||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Software License][ico-license]][link-license] | ||
[![Build Status][ico-travis]][link-travis] | ||
[![Quality Score][ico-code-quality]][link-code-quality] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
|
||
## Introduction | ||
|
||
This is a repository intended to serve as a starting point if you want to bootstrap a project in PHP. This repository has been explained in the [CodelyTV video "Introducción a PHP: Cómo configurar tu entorno de desarrollo 🐘" (Spanish)](https://www.youtube.com/watch?v=v2IjMrpZog4). | ||
|
||
It could be useful if you want to start from scratch a kata or a little exercise or project. The idea is that you don't have to worry about the boilerplate, just run `composer create-project codelytv/php-bootstrap your-project-name` and there you go: | ||
* Latest versions of PHP and PHPUnit | ||
* Best practices applied: | ||
* [`README.md`][link-readme] (badges included) | ||
* [`LICENSE`][link-license] | ||
* [`composer.json`][link-composer-json] | ||
* [`phpunit.xml`][link-phpunit] | ||
* [`.gitignore`][link-gitignore] | ||
* [`.editorconfig`][link-editorconfig] | ||
* [`.travis.yml`][link-travis-yml] | ||
* [`.scrutinizer.yml`][link-scrutinizer] | ||
* Some useful resources to start coding | ||
|
||
## How To Start | ||
|
||
You have 2 different alternatives: Using our [Packagist project](https://packagist.org/packages/codelytv/php-bootstrap) with Composer, or manually cloning [this repo](https://github.com/CodelyTV/php-bootstrap/): | ||
|
||
### Using Composer | ||
|
||
Start completely from scratch without having to delete this bootstrap project Git history: | ||
|
||
1. If you don't have it already, [install Composer](https://getcomposer.org/download/). | ||
2. Create your project based on the [Packagist project](https://packagist.org/packages/codelytv/php-bootstrap). This will also download the project dependencies: `composer create-project codelytv/php-bootstrap your-project-name`. | ||
3. Move to the project directory: `cd your-project-name` | ||
4. Run all the checks: `composer test`. This will do some checks that you can perform with isolated commands: | ||
1. [PHP Parallel Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint): `composer lint`. | ||
2. [PHP Style Check](https://github.com/squizlabs/PHP_CodeSniffer): `composer style`. If you want to fix style issues automatically: `composer fix-style`. | ||
3. [PHP Unit](https://phpunit.de/): `composer phpunit`. | ||
5. Create your own repository: | ||
1. Initialize your own Git repository: `git init` | ||
2. Add the bootstrap files: `git add .` | ||
3. Commit: `git commit -m "Initial commit with project boilerplate based on https://github.com/CodelyTV/php-bootstrap"` | ||
4. Add your remote repository: `git remote add origin [email protected]:your-username/your-project-name` | ||
5. Upload your local commits to the new remote repo: `git push -u origin master` | ||
6. Start coding! | ||
|
||
### Cloning the repository | ||
|
||
Just in case you prefer to avoid dealing with `composer create-project`, you can also clone this repository. We recommend to follow the next step by step process in order to avoid adding the bootstrap project commits to your project Git history: | ||
|
||
1. Clone this repository: `git clone https://github.com/CodelyTV/php-bootstrap your-project-name` | ||
2. Move to the project directory: `cd your-project-name` | ||
3. If you don't have it already, [install Composer](https://getcomposer.org/download/). | ||
4. Install the project dependencies: `composer install` | ||
5. Run all the checks: `composer test`. This will do some checks that you can perform with isolated commands: | ||
1. [PHP Parallel Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint): `composer lint`. | ||
2. [PHP Style Check](https://github.com/squizlabs/PHP_CodeSniffer): `composer style`. If you want to fix style issues automatically: `composer fix-style`. | ||
3. [PHP Unit](https://phpunit.de/): `composer phpunit`. | ||
6. Create your own repository cleaning the bootstrap project history: | ||
1. Remove previous Git history in order to do not add the bootstrap repo noise in your project: `rm -rf .git` | ||
2. Initialize your own Git repository: `git init` | ||
3. Add the bootstrap files: `git add .` | ||
4. Commit: `git commit -m "Initial commit with project boilerplate based on https://github.com/CodelyTV/php-bootstrap"` | ||
5. Add your remote repository: `git remote add origin [email protected]:your-username/your-project-name` | ||
6. Upload your local commits to the new remote repo: `git push -u origin master` | ||
7. Start coding! | ||
|
||
## Helpful resources | ||
|
||
### PHP 7 | ||
|
||
* [PHP 7 new features](http://php.net/manual/en/migration70.new-features.php) | ||
* [Scalar type declarations example](https://github.com/tpunt/PHP7-Reference#scalar-type-declarations) | ||
* [Return type declarations example](https://github.com/tpunt/PHP7-Reference#return-type-declarations) | ||
|
||
### PHPUnit | ||
|
||
* [Introduction to writing tests for PHPUnit](https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html) | ||
* [Testing exceptions with PHPUnit](https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions) | ||
* [PHPUnit assertions](https://phpunit.de/manual/current/en/appendixes.assertions.html) | ||
|
||
### Refactoring | ||
|
||
* [Refactoring.guru Code Smells catalog](https://refactoring.guru/smells/smells) | ||
* [Refactoring.guru Refactorings catalog](https://refactoring.guru/catalog) | ||
* [SourceMaking Refactorings catalog](https://sourcemaking.com/refactoring) | ||
* [Martin Fowler Refactorings catalog](http://refactoring.com/catalog/) | ||
* [CodelyTV Refactoring videos (Spanish)](http://codely.tv/tag/refactoring/) | ||
|
||
## Other programming languages | ||
|
||
* [PHP](https://github.com/CodelyTV/php-bootstrap) | ||
* [Scala](https://github.com/CodelyTV/scala_bootstrap) | ||
|
||
## About | ||
|
||
This hopefully helpful utility has been developed by [CodelyTV][link-author] and [contributors][link-contributors]. | ||
|
||
We'll try to maintain this project as simple as possible, but Pull Requests are welcomed! | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File][link-license] for more information. | ||
|
||
[ico-version]: https://img.shields.io/packagist/v/codelytv/php-bootstrap.svg?style=flat-square | ||
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square | ||
[ico-travis]: https://img.shields.io/travis/CodelyTV/php-bootstrap/master.svg?style=flat-square | ||
[ico-code-quality]: https://img.shields.io/scrutinizer/g/CodelyTV/php-bootstrap.svg?style=flat-square | ||
[ico-downloads]: https://img.shields.io/packagist/dt/codelytv/php-bootstrap.svg?style=flat-square | ||
|
||
[link-packagist]: https://packagist.org/packages/codelytv/php-bootstrap | ||
[link-license]: LICENSE | ||
[link-travis]: https://travis-ci.org/CodelyTV/php-bootstrap | ||
[link-code-quality]: https://scrutinizer-ci.com/g/CodelyTV/php-bootstrap | ||
[link-downloads]: https://packagist.org/packages/codelytv/php-bootstrap | ||
[link-readme]: README.md | ||
[link-composer-json]: composer.json | ||
[link-phpunit]: phpunit.xml | ||
[link-gitignore]: .gitignore | ||
[link-editorconfig]: .editorconfig | ||
[link-travis-yml]: .travis.yml | ||
[link-scrutinizer]: .scrutinizer.yml | ||
[link-author]: https://github.com/CodelyTV | ||
[link-contributors]: ../../contributors |
65 changes: 65 additions & 0 deletions
65
examples/php/php-step_shotgun_surgery-01_base/composer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"name": "codelytv/php-bootstrap", | ||
"description": "Starting point if you want to bootstrap a project in PHP following best practices.", | ||
"type": "project", | ||
"keywords": [ | ||
"bootstrap", | ||
"skeleton", | ||
"kata", | ||
"TDD", | ||
"boilerplate" | ||
], | ||
"homepage": "https://codely.tv", | ||
"time": "2018-07-18", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Javier Ferrer", | ||
"email": "[email protected]", | ||
"homepage": "https://codely.tv", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "Rafa Gómez", | ||
"email": "[email protected]", | ||
"homepage": "https://codely.tv", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.4" | ||
}, | ||
"require-dev": { | ||
"jakub-onderka/php-parallel-lint": "^1.0", | ||
"jakub-onderka/php-console-highlighter": "^0.3", | ||
"squizlabs/php_codesniffer": "^3.3", | ||
"phpunit/phpunit": "^7.2", | ||
"symfony/var-dumper": "^4.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"CodelyTv\\StepShotgunSurgery\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"CodelyTv\\StepShotgunSurgery\\Tests\\": "tests/" | ||
} | ||
}, | ||
"minimum-stability": "stable", | ||
"config": { | ||
"optimize-autoloader": true | ||
}, | ||
"prefer-stable": true, | ||
"scripts": { | ||
"lint": "parallel-lint . --exclude vendor", | ||
"style": "phpcs -p --standard=PSR2 src tests", | ||
"fix-style": "phpcbf -p --standard=PSR2 src tests", | ||
"phpunit": "phpunit --configuration phpunit.xml", | ||
"test": [ | ||
"parallel-lint . --exclude vendor", | ||
"phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests", | ||
"phpunit --configuration phpunit.xml" | ||
] | ||
} | ||
} |
Oops, something went wrong.