-
Notifications
You must be signed in to change notification settings - Fork 142
[php] Add energy power #48
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
Open
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
examples/php/php-energy_power-01_base/.editorconfig
This file contains hidden or 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 |
2 changes: 2 additions & 0 deletions
examples/php/php-energy_power-01_base/.gitignore
This file contains hidden or 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,2 @@ | ||
| vendor/ | ||
| .phpunit.result.cache |
4 changes: 4 additions & 0 deletions
examples/php/php-energy_power-01_base/.scrutinizer.yml
This file contains hidden or 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' |
5 changes: 5 additions & 0 deletions
examples/php/php-energy_power-01_base/.semver
This file contains hidden or 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: '' |
21 changes: 21 additions & 0 deletions
examples/php/php-energy_power-01_base/LICENSE
This file contains hidden or 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. |
117 changes: 117 additions & 0 deletions
examples/php/php-energy_power-01_base/README.md
This file contains hidden or 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,117 @@ | ||
| # 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 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! | ||
|
|
||
| ### 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. [Use this repositoy 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`. | ||
| 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-scrutinizer]: .scrutinizer.yml | ||
| [link-author]: https://github.com/CodelyTV |
45 changes: 45 additions & 0 deletions
examples/php/php-energy_power-01_base/composer.json
This file contains hidden or 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,45 @@ | ||
| { | ||
| "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", | ||
| "license": "MIT", | ||
| "authors": [ | ||
| { | ||
| "name": "CodelyTV", | ||
| "homepage": "https://codely.tv" | ||
| } | ||
| ], | ||
| "require": { | ||
| "php": "^7.4||^8.0" | ||
| }, | ||
| "require-dev": { | ||
| "squizlabs/php_codesniffer": "^3.5", | ||
| "phpunit/phpunit": "^9.4" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "CodelyTv\\": "src/" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "CodelyTv\\Tests\\": "tests/" | ||
| } | ||
| }, | ||
| "minimum-stability": "stable", | ||
| "config": { | ||
| "optimize-autoloader": true | ||
| }, | ||
| "prefer-stable": true, | ||
| "scripts": { | ||
| "style": "phpcs -p --standard=PSR2 src tests", | ||
| "fix-style": "phpcbf -p --standard=PSR2 src tests", | ||
| "phpunit": "phpunit --configuration phpunit.xml", | ||
| "test": [ | ||
| "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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.