alcidesrc/php-skeleton

Application skeleton for projects based on PHP

Fund package maintenance!
AlcidesRC
www.paypal.me/AlcidesRC

Installs: 24

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Language:Makefile

Type:project

1.0.5 2024-09-08 19:31 UTC

This package is auto-updated.

Last update: 2024-09-08 19:32:07 UTC


README

Continuous Integration

PHP Skeleton

An application skeleton for modern PHP projects.

[TOC]

Summary

This repository contains an application skeleton following best practices.

Highlights

  • Minimalist project
  • Includes frequently used tools such as a Linter, PHPStan, PHPUnit, ClockMock, CodeSniffer and VarDumper.

Requirements

To use this repository you need:

Software

  • Git - The free and open source distributed version control system.

Built with

This project was built with Dockerized PHP, a lightweight dockerized environment to build PHP applications.

Getting Started

Just clone the repository into your preferred path:

$ mkdir -p ~/path/to/my-new-project && cd ~/path/to/my-new-project
$ git clone git@github.com:alcidesrc/php-skeleton.git .

Conventions

Directory structure

.
├── app                 # Application business logic goes here
├── public              # Public folder
│   └── index.php       # Application entry point
├── tests               # Tests folder
│   └── Unit            # Unit Tests folder
├── vendor              # Dependencies folder
├── .gitignore          # Git ignore file
├── composer.json       # Composer dependencies files
├── composer.lock       # Composer lock file
├── LICENSE             # License document
├── Makefile            # Makefile with frequent commands
├── phpcs.xml           # PHPCS configuration file
├── phpstan.neon        # PHPStan configuration file
├── phpunit.xml         # PHPUnit configuration file
└── README.md           # This document

Composer commands

Custom commands are added to composer.json under the scripts section.

Available commands

Makefile

Additionally a Makefile is provided with frequently used commands:

~/path/to/my-new-project$ make

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║                           .: AVAILABLE COMMANDS :.                           ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

· composer-dump                  [COMPOSER] Executes <composer dump-auto> inside the container
· composer-install               [COMPOSER] Executes <composer install> inside the container
· composer-remove                [COMPOSER] Executes <composer remove> inside the container
· composer-require-dev           [COMPOSER] Executes <composer require --dev> inside the container
· composer-require               [COMPOSER] Executes <composer require> inside the container
· composer-update                [COMPOSER] Executes <composer update> inside the container
· check-syntax                   [QA] Executes <check-syntax [filter=app]> inside the container
· check-style                    [QA] Executes <check-style [filter=app]> inside the container
· fix-style                      [QA] Executes <fix-style [filter=app]> inside the container
· phpstan                        [QA] Executes <phpstan [filter=app]> inside the container
· tests                          [QA] Executes <phpunit --testsuite=[testsuite=Unit] --filter=[filter=.]> inside the container
· coverage                       [QA] Executes <phpunit --coverage-html=[folder=./coverage]> inside the container
Installing Dependencies
$ make composer-install
Running the Test Cases
Default command
$ make tests [filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"]
Run only Unit testsuite
$ make tests-unit [filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"]

Volumes

Coverage report in HTML

Coverage report in HTML is generated on a root folder /coverage

Tip

If you want the report is generated on a different path, just update accordingly the composer.json file under the section scripts

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities:

PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY

Supported Versions

Only the latest major version receives security fixes.

Reporting a Vulnerability

If you discover a security vulnerability within this project, please open an issue here. All security vulnerabilities will be promptly addressed.

License

The MIT License (MIT). Please see LICENSE file for more information.