Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/royrakesh/skeleton-php

A skeleton for modern PHP development, providing a clean structure and essential tooling.
https://github.com/royrakesh/skeleton-php

composer composer-package php

Last synced: 3 days ago
JSON representation

A skeleton for modern PHP development, providing a clean structure and essential tooling.

Awesome Lists containing this project

README

        



# Skeleton PHP

![PHP Skeleton](https://img.shields.io/badge/PHP-Skeleton-blue.svg)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/royrakesh/skeleton-php/php.yml?branch=main)

A skeleton for modern PHP development, providing a clean structure and essential tooling.

## 🚀 Features
- PSR-4 autoloading
- Pest for testing
- Laravel Pint for code formatting
- PHPStan for static analysis
- Rector for code refactorin
- Compatible with php 8.2 , 8.3 and 8.4

## 🛠 Usage

### Lint Code
```sh
composer lint
```

### Run Unit Test
```sh
composer test:unit
```

### Static Analysis
```sh
composer test:types
```

### Test Code Format
```sh
composer test:lint
```

### Run Everything
```sh
composer test
```

## 🏗 Folder Structure
```
src/ # Main source code
tests/ # Unit and feature tests
```

## ✨ Example Implementation

### Greeting Contract
```php
greetingService = new GreetingService();
}

public function greet(string $name): string
{
return $this->greetingService->greet($name);
}
}
```

### Pest Test for GreetingService
```php
greet('Rakesh'))->toBe('Hello, Rakesh!');
});
```

### Pest Test for Greeting
```php
greet('Rakesh');

expect($result)->toBe('Hello, Rakesh!');
});

it('greets a user with an empty name', function () {
$greeting = new Greeting();

$result = $greeting->greet('');

expect($result)->toBe('Hello, !');
});
```

## 🔗 Credits
This package utilizes the following open-source tools:
- [PestPHP](https://pestphp.com/) - A modern PHP testing framework.
- [Laravel Pint](https://github.com/laravel/pint) - An opinionated PHP code formatter.
- [PHPStan](https://phpstan.org/) - Static analysis tool for PHP.
- [Rector](https://github.com/rectorphp/rector) - Automated code refactoring tool.

## 📝 License
This project is licensed under the MIT License.

## 👤 Author
**Rakesh Roy**
[Website](https://royrakesh.dev) | [Email](mailto:[email protected])