derafu / foundation
Derafu: Foundation - Base for Derafu's Projects
Installs: 363
Dependents: 30
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Twig
Requires
- php: ^8.3
- composer/composer: ^2.8
- derafu/http: dev-main
- derafu/markdown: ^1.0
Requires (Dev)
- ext-xdebug: *
- friendsofphp/php-cs-fixer: ^3.63
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^11.4
This package is auto-updated.
Last update: 2025-03-12 13:57:36 UTC
README
Overview
Derafu Foundation is a standardized base for creating consistent PHP projects. It provides a pre-configured environment with best practices for code organization, documentation, testing, and code quality assurance. This foundation is designed to streamline the creation of new projects while ensuring they follow consistent patterns and standards.
Key Features
- Standardized Structure: Consistent file and directory organization across all projects.
- Code Quality Tools: Pre-configured PHP CS Fixer, PHPStan, and PHPUnit setups.
- Asset Management: Built-in Vite configuration for CSS, JavaScript, and image optimization.
- Documentation: Automatic website generation from README.md with GitHub Pages deployment.
- CI/CD Integration: GitHub Actions workflows for continuous integration and deployment.
- Middleware-based HTTP Layer: Ready-to-use PSR-compliant HTTP handling.
- Routing System: Flexible routing with support for static routes and filesystem-based routes.
- Templating: Twig and Markdown rendering support.
Quick Start
Installation
Create a new project based on this foundation:
composer create-project derafu/project project_dir --stability=dev
Asset Compilation
If your project uses CSS, JavaScript, or images, add them to the assets
directory and compile them:
npm install npm run build
Development Server
Start the built-in PHP development server:
php -S localhost:9000 public/index.php
Then visit http://localhost:9000 to see your project.
Project Structure
project_dir/
├── .github/ # GitHub configurations and workflows.
├── app/ # Application bootstrap files.
├── assets/ # Frontend assets (CSS, JS, images).
├── config/ # Configuration files.
│ ├── routes.yaml # Route definitions.
│ └── services.yaml # Service container configuration.
├── public/ # Web server root directory.
│ ├── index.php # Application entry point.
│ └── static/ # Compiled assets (generated).
├── src/ # Source code.
├── templates/ # Template files.
│ ├── components/ # Reusable template components.
│ ├── layouts/ # Layout templates.
│ └── pages/ # Page templates.
├── tests/ # Test files.
│ ├── fixtures/ # Test fixtures.
│ └── src/ # Source code tests.
├── vendor/ # Composer dependencies.
├── var/ # Temporary files and caches.
├── .gitignore # Git ignore configuration.
├── LICENSE # MIT License.
├── package.json # NPM configuration.
├── php-cs-fixer.php # PHP CS Fixer configuration.
├── phpstan.neon # PHPStan configuration.
├── phpunit.xml # PHPUnit configuration.
├── README.md # Project documentation.
└── vite.config.js # Vite build configuration.
Customization
After creating a project based on this foundation, you can:
- Modify
README.md
with your project-specific details. - Update
package.json
with your project information. - Add your routes in
config/routes.yaml
. - Customize services in
config/services.yaml
. - Create controllers and other classes in the
src/
directory. - Add templates to the
templates/
directory. - Write tests in the
tests/
directory.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This package is open-sourced software licensed under the MIT license.
Happy coding! ✨