easifyphp / bmi
A simple Body Mass Index (BMI) library.
Requires
- php: >=8.2
Requires (Dev)
- ergebnis/composer-normalize: ^2.31
- fakerphp/faker: ^1.21
- friendsofphp/php-cs-fixer: ^3.16
- jetbrains/phpstorm-attributes: ^1.0
- pestphp/pest: ^2.6
- roave/security-advisories: dev-latest
- xheaven/composer-git-hooks: ^3.0
README
This is a template for all EasifyPHP packages. It provides a starting point to create a library that follows modern PHP standards.
Features
- PSR-4 autoloading.
- PHP 8.2+ requirement.
- Pre-configured for use with PHP CS Fixer, Pest, Faker, JetBrains PhpStorm Attributes, Composer Normalize, Symfony VarDumper, and Roave Security Advisories.
- Scripts for testing, test coverage, and code fixing.
Installation
Use Composer to create a project from this template.
composer create-project easifyphp/template
Usage
After installing, replace the namespace Easifyphp\Template
with the namespace you prefer. The source files should be
placed in the src/
directory.
The template includes Faker for generating fake data in your tests or seed scripts. You can use it like so:
$faker = Faker\Factory::create(); $name = $faker->name();
Additionally, the template includes the JetBrains PhpStorm Attributes package. This package provides additional syntax support when you're using JetBrains PhpStorm as your IDE.
use JetBrains\PhpStorm\ArrayShape; #[ArrayShape(['id' => 'int', 'name' => 'string'])] function getEntityData(): array { // ... }
The template also includes the Symfony VarDumper package. This package provides
a better var_dump()
function that is easier to read and understand.
dump($data);
Please refer to the package documentation for more details on how to use it effectively in your project.
Testing
Use Pest for testing. You can run the tests with the following command:
composer run test
To check the test coverage, run:
composer run test:coverage
This template enforces a minimum test coverage of 90%.
Code Formatting
The template uses PHP CS Fixer for code formatting. You can run the formatter with the following command:
composer run fix
Contributing
Please see CONTRIBUTING.md for details.
Security Vulnerabilities
If you discover a security vulnerability within this template, please send an e-mail to Mark via hello@mmark.me. All security vulnerabilities will be promptly addressed.
License
The EasifyPHP Template is open-sourced software licensed under the MIT license.
Credits
- Mark (Author)