|
2 | 2 |
|
3 | 3 | [](https://github.com/JBZoo/Skeleton-Php/actions/workflows/main.yml?query=branch%3Amaster) [](https://coveralls.io/github/JBZoo/Skeleton-PHP?branch=master) [](https://shepherd.dev/github/JBZoo/Skeleton-Php) [](https://shepherd.dev/github/JBZoo/Skeleton-Php) [](https://www.codefactor.io/repository/github/jbzoo/skeleton-php/issues) |
4 | 4 |
|
| 5 | +## Overview |
5 | 6 |
|
6 | | -This is not a completed library, but only a blank. |
7 | | -It aims to clean up the minds of programmers and standardize the development of open-source libraries for JBZoo. |
| 7 | +This is a project skeleton template for creating new PHP libraries within the JBZoo ecosystem. It's not a completed library but a standardized template that helps maintain consistency across JBZoo projects. |
8 | 8 |
|
| 9 | +The skeleton includes: |
| 10 | +- Modern PHP 8.2+ setup with strict typing |
| 11 | +- Comprehensive testing framework integration |
| 12 | +- Complete CI/CD pipeline configuration |
| 13 | +- Integrated code quality tools (PHPStan, Psalm, PHP-CS-Fixer, etc.) |
| 14 | +- JBZoo coding standards and conventions |
9 | 15 |
|
10 | | -### Action items |
| 16 | +## Quick Start |
11 | 17 |
|
12 | | - * Create a new repository (MIT, without .gitignore). |
13 | | - * Make a checkout of a clean repository for a working machine. |
14 | | - * [Download the latest version of the skeleton](https://github.com/JBZoo/Skeleton/archive/master.zip). |
15 | | - * Run the skeleton script for your package through `php ./create-new-project.php Skeleton-Php` |
| 18 | +### Creating a New Project |
16 | 19 |
|
| 20 | +1. **Create a new repository** (MIT license, without .gitignore) |
| 21 | +2. **Clone the skeleton**: |
| 22 | + ```bash |
| 23 | + git clone https://github.com/JBZoo/Skeleton-Php.git your-project-name |
| 24 | + cd your-project-name |
| 25 | + ``` |
| 26 | +3. **Initialize the project**: |
| 27 | + ```bash |
| 28 | + make update |
| 29 | + php create-new-project.php Project-Name |
| 30 | + make update |
| 31 | + ``` |
17 | 32 |
|
18 | | -### License |
| 33 | +The initialization script will: |
| 34 | +- Replace all template placeholders with your package name |
| 35 | +- Rename template files to match your namespace |
| 36 | +- Update composer.json and other configuration files |
| 37 | +- Clean up skeleton-specific files |
| 38 | + |
| 39 | +### Development Commands |
| 40 | + |
| 41 | +```bash |
| 42 | +# Install/update dependencies |
| 43 | +make update |
| 44 | + |
| 45 | +# Develop cycle |
| 46 | +make skel-test |
| 47 | + |
| 48 | +# fix, commit, git reset --hard, repeat. |
| 49 | + |
| 50 | +# Run all tests and code quality checks |
| 51 | +make test-all |
| 52 | + |
| 53 | +# Run individual tools |
| 54 | +make test # PHPUnit tests |
| 55 | +make codestyle # All linters |
| 56 | +``` |
| 57 | + |
| 58 | +## Project Structure |
| 59 | + |
| 60 | +``` |
| 61 | +├── src/ # Main library code |
| 62 | +├── tests/ # PHPUnit tests |
| 63 | +├── create-new-project.php # Skeleton transformation script |
| 64 | +├── Makefile # Build commands |
| 65 | +├── phpunit.xml.dist # PHPUnit configuration |
| 66 | +└── composer.json # Dependencies and autoloading |
| 67 | +``` |
| 68 | + |
| 69 | +## Template System |
| 70 | + |
| 71 | +The skeleton uses placeholder tokens that get replaced during project creation: |
| 72 | + |
| 73 | +- `__PACKAGE__` → Your package name (e.g., "MyAwesomeLib") |
| 74 | +- `__NS__` → Your namespace (e.g., "MyAwesomeLib") |
| 75 | +- `jbzoo/skeleton-php` → Your composer package name |
| 76 | + |
| 77 | +Template files that get renamed: |
| 78 | +- `src/__NS__.php` → `src/YourClassName.php` |
| 79 | +- `tests/__NS__Test.php` → `tests/YourClassNameTest.php` |
| 80 | + |
| 81 | +## Requirements |
| 82 | + |
| 83 | +- PHP 8.2 or higher |
| 84 | +- Composer 2.0+ |
| 85 | +- Make (for build commands) |
| 86 | + |
| 87 | +## Code Quality |
| 88 | + |
| 89 | +The skeleton includes comprehensive code quality tools: |
| 90 | + |
| 91 | +- **PHPUnit** - Unit testing framework |
| 92 | +- **PHPStan** - Static analysis (level max) |
| 93 | +- **Psalm** - Additional static analysis |
| 94 | +- **PHP-CS-Fixer** - Code style fixer |
| 95 | +- **PHPMD** - Mess detector |
| 96 | +- **Phan** - Static analyzer |
| 97 | + |
| 98 | +All tools are pre-configured with JBZoo standards and integrate with CI/CD pipelines. |
| 99 | + |
| 100 | +## CI/CD |
| 101 | + |
| 102 | +The skeleton includes GitHub Actions workflow that: |
| 103 | +- Tests against multiple PHP versions |
| 104 | +- Runs all quality assurance tools |
| 105 | +- Generates coverage reports |
| 106 | +- Validates composer configuration |
| 107 | + |
| 108 | +## License |
19 | 109 |
|
20 | 110 | MIT |
0 commit comments