Skip to content

feat: improve readme #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trim_trailing_whitespace = true

[*.php]
indent_size = 4
indent_style = space
indent_style = tab

[*.md]
trim_trailing_whitespace = false
131 changes: 62 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,117 +1,110 @@
# PHP Bootstrap (base / project skeleton)
# 🐘 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]
[![Build Status][ico-gh-actions]][link-gh-actions]
[![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:
## 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]
* [`README.md`][link-readme]
* [`LICENSE`][link-license]
* [`composer.json`][link-composer-json]
* [`ecs.php`](./ecs.php)
* [`phpunit.xml`][link-phpunit]
* [`psalm.xml`](./psalm.xml)
* [`.gitignore`][link-gitignore]
* [`.editorconfig`][link-editorconfig]
* 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/):
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`.
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`.
4. Run all the checks: `composer test`. This will do some checks that you can perform with isolated commands:
1. [Codely Style](https://github.com/CodelyTV/php-coding_style-codely): `composer lint`.
2. [Easy coding standard](https://github.com/easy-coding-standard/easy-coding-standard): `composer style`. If you
want to fix style issues automatically: `composer lint:fix`.
3. [Static Analysis](https://github.com/vimeo/psalm): `composer static-analysis`.
4. [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 git@github.com:your-username/your-project-name`
5. Upload your local commits to the new remote repo: `git push -u origin master`
6. Start coding!
6. Start coding!

### Cloning the repository
### 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:
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. [Use this repositoy template](https://github.com/CodelyTV/php-basic-skeleton/generate)
1. [Use this repository template](https://github.com/CodelyTV/php-basic-skeleton/generate)
2. Clone your project
3. Move to the project directory: `cd your-project-name`
4. If you don't have it already, [install Composer](https://getcomposer.org/download/).
5. Install the project dependencies: `composer install`
6. Run all the checks: `composer test`. This will do some checks that you can perform with isolated commands:
1. [PHP Style Check](https://github.com/squizlabs/PHP_CodeSniffer): `composer style`. If you want to fix style issues automatically: `composer fix-style`.
2. [PHP Unit](https://phpunit.de/): `composer phpunit`.
6. Run the tests: `composer test`.
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
## Related skeleton templates

* [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)
This very same basic skeleton philosophy implemented in other programming languages:

### Refactoring
- [🔷🕸️ TypeScript Web Skeleton](https://github.com/CodelyTV/typescript-web-skeleton)
- [🔷🌍 TypeScript API Skeleton](https://github.com/CodelyTV/typescript-api-skeleton)
- [🔷✨ TypeScript DDD Skeleton](https://github.com/CodelyTV/typescript-ddd-skeleton)
- [✨ JavaScript Basic Skeleton](https://github.com/CodelyTV/javascript-basic-skeleton)
- [☕ Java Basic Skeleton](https://github.com/CodelyTV/java-basic-skeleton)
- [📍 Kotlin Basic Skeleton](https://github.com/CodelyTV/kotlin-basic-skeleton)
- [🧬 Scala Basic Skeleton](https://github.com/CodelyTV/scala-basic-skeleton)
- [🦈 C# Basic Skeleton](https://github.com/CodelyTV/csharp-basic-skeleton)

* [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!
[ico-version]: https://img.shields.io/packagist/v/codelytv/php-bootstrap.svg?style=flat-square

## License
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square

The MIT License (MIT). Please see [License File][link-license] for more information.
[ico-gh-actions]: https://github.com/CodelyTV/php-basic-skeleton/actions/workflows/ci.yml/badge.svg

[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-gh-actions]: https://github.com/CodelyTV/php-basic-skeleton/actions

[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-scrutinizer]: .scrutinizer.yml
[link-author]: https://github.com/CodelyTV

[link-editorconfig]: .editorconfig