Skip to content

Commit 26bcc33

Browse files
authored
Merge pull request #16 from CodelyTV/php-user
[php][user_email] Add example
2 parents 282f31a + 67b9253 commit 26bcc33

File tree

78 files changed

+12474
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+12474
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.php]
13+
indent_size = 4
14+
indent_style = space
15+
16+
[*.md]
17+
trim_trailing_whitespace = false
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
.phpunit.result.cache
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build:
2+
environment:
3+
php:
4+
version: '7.2'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
:major: 1
3+
:minor: 2
4+
:patch: 1
5+
:special: ''
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2018 CodelyTV. https://codely.tv
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# PHP Bootstrap (base / project skeleton)
2+
3+
[![Latest Version on Packagist][ico-version]][link-packagist]
4+
[![Software License][ico-license]][link-license]
5+
[![Build Status][ico-travis]][link-travis]
6+
[![Quality Score][ico-code-quality]][link-code-quality]
7+
[![Total Downloads][ico-downloads]][link-downloads]
8+
9+
## Introduction
10+
11+
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).
12+
13+
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:
14+
* Latest versions of PHP and PHPUnit
15+
* Best practices applied:
16+
* [`README.md`][link-readme] (badges included)
17+
* [`LICENSE`][link-license]
18+
* [`composer.json`][link-composer-json]
19+
* [`phpunit.xml`][link-phpunit]
20+
* [`.gitignore`][link-gitignore]
21+
* [`.editorconfig`][link-editorconfig]
22+
* [`.travis.yml`][link-travis-yml]
23+
* [`.scrutinizer.yml`][link-scrutinizer]
24+
* Some useful resources to start coding
25+
26+
## How To Start
27+
28+
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/):
29+
30+
### Using Composer
31+
32+
Start completely from scratch without having to delete this bootstrap project Git history:
33+
34+
1. If you don't have it already, [install Composer](https://getcomposer.org/download/).
35+
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`.
36+
3. Move to the project directory: `cd your-project-name`
37+
4. Run all the checks: `composer test`. This will do some checks that you can perform with isolated commands:
38+
1. [PHP Parallel Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint): `composer lint`.
39+
2. [PHP Style Check](https://github.com/squizlabs/PHP_CodeSniffer): `composer style`. If you want to fix style issues automatically: `composer fix-style`.
40+
3. [PHP Unit](https://phpunit.de/): `composer phpunit`.
41+
5. Create your own repository:
42+
1. Initialize your own Git repository: `git init`
43+
2. Add the bootstrap files: `git add .`
44+
3. Commit: `git commit -m "Initial commit with project boilerplate based on https://github.com/CodelyTV/php-bootstrap"`
45+
4. Add your remote repository: `git remote add origin git@github.com:your-username/your-project-name`
46+
5. Upload your local commits to the new remote repo: `git push -u origin master`
47+
6. Start coding!
48+
49+
### Cloning the repository
50+
51+
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:
52+
53+
1. [Use this repositoy template](https://github.com/CodelyTV/php-basic-skeleton/generate)
54+
2. Clone your project
55+
3. Move to the project directory: `cd your-project-name`
56+
4. If you don't have it already, [install Composer](https://getcomposer.org/download/).
57+
5. Install the project dependencies: `composer install`
58+
6. Run all the checks: `composer test`. This will do some checks that you can perform with isolated commands:
59+
1. [PHP Style Check](https://github.com/squizlabs/PHP_CodeSniffer): `composer style`. If you want to fix style issues automatically: `composer fix-style`.
60+
2. [PHP Unit](https://phpunit.de/): `composer phpunit`.
61+
7. Start coding!
62+
63+
## Helpful resources
64+
65+
### PHP 7
66+
67+
* [PHP 7 new features](http://php.net/manual/en/migration70.new-features.php)
68+
* [Scalar type declarations example](https://github.com/tpunt/PHP7-Reference#scalar-type-declarations)
69+
* [Return type declarations example](https://github.com/tpunt/PHP7-Reference#return-type-declarations)
70+
71+
### PHPUnit
72+
73+
* [Introduction to writing tests for PHPUnit](https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html)
74+
* [Testing exceptions with PHPUnit](https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions)
75+
* [PHPUnit assertions](https://phpunit.de/manual/current/en/appendixes.assertions.html)
76+
77+
### Refactoring
78+
79+
* [Refactoring.guru Code Smells catalog](https://refactoring.guru/smells/smells)
80+
* [Refactoring.guru Refactorings catalog](https://refactoring.guru/catalog)
81+
* [SourceMaking Refactorings catalog](https://sourcemaking.com/refactoring)
82+
* [Martin Fowler Refactorings catalog](http://refactoring.com/catalog/)
83+
* [CodelyTV Refactoring videos (Spanish)](http://codely.tv/tag/refactoring/)
84+
85+
## Other programming languages
86+
87+
* [PHP](https://github.com/CodelyTV/php-bootstrap)
88+
* [Scala](https://github.com/CodelyTV/scala_bootstrap)
89+
90+
## About
91+
92+
This hopefully helpful utility has been developed by [CodelyTV][link-author] and [contributors][link-contributors].
93+
94+
We'll try to maintain this project as simple as possible, but Pull Requests are welcomed!
95+
96+
## License
97+
98+
The MIT License (MIT). Please see [License File][link-license] for more information.
99+
100+
[ico-version]: https://img.shields.io/packagist/v/codelytv/php-bootstrap.svg?style=flat-square
101+
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
102+
[ico-travis]: https://img.shields.io/travis/CodelyTV/php-bootstrap/master.svg?style=flat-square
103+
[ico-code-quality]: https://img.shields.io/scrutinizer/g/CodelyTV/php-bootstrap.svg?style=flat-square
104+
[ico-downloads]: https://img.shields.io/packagist/dt/codelytv/php-bootstrap.svg?style=flat-square
105+
106+
[link-packagist]: https://packagist.org/packages/codelytv/php-bootstrap
107+
[link-license]: LICENSE
108+
[link-travis]: https://travis-ci.org/CodelyTV/php-bootstrap
109+
[link-code-quality]: https://scrutinizer-ci.com/g/CodelyTV/php-bootstrap
110+
[link-downloads]: https://packagist.org/packages/codelytv/php-bootstrap
111+
[link-readme]: README.md
112+
[link-composer-json]: composer.json
113+
[link-phpunit]: phpunit.xml
114+
[link-gitignore]: .gitignore
115+
[link-editorconfig]: .editorconfig
116+
[link-scrutinizer]: .scrutinizer.yml
117+
[link-author]: https://github.com/CodelyTV
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "codelytv/php-bootstrap",
3+
"description": "Starting point if you want to bootstrap a project in PHP following best practices.",
4+
"type": "project",
5+
"keywords": ["bootstrap", "skeleton", "kata", "TDD", "boilerplate"],
6+
"homepage": "https://codely.tv",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "CodelyTV",
11+
"homepage": "https://codely.tv"
12+
}
13+
],
14+
"require": {
15+
"php": ">=7.4"
16+
},
17+
"require-dev": {
18+
"squizlabs/php_codesniffer": "^3.5",
19+
"phpunit/phpunit": "^9.4"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"CodelyTv\\": "src/"
24+
}
25+
},
26+
"autoload-dev": {
27+
"psr-4": {
28+
"CodelyTv\\Tests\\": "tests/"
29+
}
30+
},
31+
"minimum-stability": "stable",
32+
"config": {
33+
"optimize-autoloader": true
34+
},
35+
"prefer-stable": true,
36+
"scripts": {
37+
"style": "phpcs -p --standard=PSR2 src tests",
38+
"fix-style": "phpcbf -p --standard=PSR2 src tests",
39+
"phpunit": "phpunit --configuration phpunit.xml",
40+
"test": [
41+
"phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests",
42+
"phpunit --configuration phpunit.xml"
43+
]
44+
}
45+
}

0 commit comments

Comments
 (0)