├── .editorconfig ├── .gitattributes ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml.dist ├── src └── Installer.php └── tests └── SkeletonTestCase.php /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org/ 2 | 3 | root = true 4 | 5 | [*] 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | indent_style = space 9 | end_of_line = lf 10 | indent_size = 4 11 | tab_width = 4 12 | charset = utf-8 13 | 14 | [*.{md,sh,yaml,yml}] 15 | indent_size = 2 16 | 17 | [*.patch] 18 | trim_trailing_whitespace = false 19 | 20 | [COMMIT_EDITMSG] 21 | max_line_length = 80 22 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /.github/ export-ignore 2 | /docs/ export-ignore 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache/ 2 | /vendor/ 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [Unreleased] 9 | 10 | ## [0.1.0] - 2014-11-15 11 | 12 | ### Added 13 | 14 | - Initial project structure 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing guidelines 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-present Peter Kokot 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP skeleton 2 | 3 | ![Test workflow](https://github.com/petk/php-skeleton/actions/workflows/tests.yaml/badge.svg) 4 | 5 | Creating PSR-4 compliant PHP package or library with Composer the easy way. 6 | 7 | This package provides a common folder structure and belonging files that are 8 | used for creating a modern PHP package/library that is PSR-4 compliant. 9 | 10 | There is no recommended or standard folder and files structure for PHP packages 11 | but there are good practices. This repository provides initial skeleton for your 12 | PHP libraries and packages. 13 | 14 | Inspired by [phpleague/skeleton](https://github.com/thephpleague/skeleton) and 15 | [php.skeleton](https://github.com/koriym/PHP.Skeleton). 16 | 17 | php-skeleton uses [Semantic Versioning](http://semver.org) 18 | 19 | ## Installation 20 | 21 | ```bash 22 | $ composer create-project petk/php-skeleton ./project 'dev-master' 23 | ``` 24 | 25 | ## Usage 26 | 27 | After creating the skeleton project directory, you can start customizing it. 28 | 29 | For example, create `index.php` and so on: 30 | 31 | ```php 32 | 2 | 12 | 13 | 14 | ./tests/ 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Installer.php: -------------------------------------------------------------------------------- 1 | getComposer(); 17 | // do stuff 18 | } 19 | 20 | public static function postCreateProject(Event $event) 21 | { 22 | $installedPackage = $event->getOperation()->getPackage(); 23 | // do stuff 24 | } 25 | 26 | public static function warmCache(Event $event) 27 | { 28 | // make cache toasty 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/SkeletonTestCase.php: -------------------------------------------------------------------------------- 1 |