tebe/php-package-skeleton

Conrete PHP Package Skeleton using Best-Practices

v0.8.0 2018-10-26 03:21 UTC

This package is auto-updated.

Last update: 2024-03-29 03:38:23 UTC


README

Travis Scrutinizer Packagist GitHub (pre-)release License PHP from Packagist

PHP Package Skeleton

This skeleton is a concrete example package based on PDS Skeleton. It uses the standard filesystem structure as proposed by PDS and adds some additional folders and files. The main idea is to create a project using this package and then remove the parts that are not used or not useful for your project.

Installation

To create a new project based on this skeleton package simply run the following command:

$ composer create-project -s dev tebe/php-package-skeleton myproject

Now, remove the parts from the created project that are not used or not useful for your project.

Summary

The package contains the following root-level directories:

Directory Description
bin/ command-line executables
config/ configuration files
docs/ documentation files
examples/ example files
public/ web server files
resources/ other resource files
src/ PHP source code
tests/ test code
vendor/ vendor files managed by composer

The package contains the following root-level files:

Files Description
CHANGELOG.md a log of changes between releases
CONTRIBUTING.md guidelines for contributors
LICENSE licensing information
README.md information about the package itself

The package contains the following scripts:

Script Description
composer test run minimal testsuite with phpunit and phpcs
composer run start webserver from public directory
composer phpunit run unit tests
composer phpcs run php code sniffer
composer docs:api build API documentation
composer docs:build build project documentation
composer docs:serve serve project documentation

Root-Level Directories

bin/

This is the root-level directory for command-line executable files. You are free to define the structure and contents of the directory.

config/

This is the root-level directory for configuration files. You are free to define the structure and contents of the directory.

docs/

This is the root-level directory for documentation files written in Markdown.

The directory contains three subfolders:

  • api: the html api documentation generated by ApiGen.
  • book: the markdown documentation for your project
  • html: the html documentation generated by MkDocs

You are free to extend the structure and contents of the directory.

examples/

This is the root-level directory for example files. You are free to define the structure and contents of the directory.

public/

This is the root-level directory for web server files. You are free to define the structure and contents of the directory.

resources/

This is the root-level directory for other resource files. You are free to define the structure and contents of the directory.

src/

This is the root-level directory for PHP source code files. You are free to define the structure and contents of the directory.

tests/

This is the root-level directory for test files run by PHPunit.

The directory contains at least

  • bootstrap.php: The bootstrap file used by PHPUnit

You are free to define the structure and contents of the directory.

vendor/

This is the root-level directory managed by Composer.

This directory is generated and MUST NOT be touched.

Other Directories

You are free to add other root-level directories for purposes not used in this skeleton.

Root-Level Files

.apigen.yml

(TBD)

.gitignore

(TBD)

.travis.yml

(TBD)

CHANGELOG.md

This is the root-level file with a list of changes since the last release or version. You are free to define the structure and contents of the file.

.composer.json

(TBD)

.composer.lock

(TBD)

CONTRIBUTING.md

This is the root-level file that describes how to contribute to the package. You are free to define the structure and contents of the file.

LICENSE

This is the root-level file indicating the licensing and copyright terms of the package contents.

This is needed by package consumers which might be in violation of copyright law when copying unlicensed intellectual property.

You are free to define the structure and contents of the file.

mkdocs.yml

(TBD)

phpcs.xml

(TBD)

phpunit.xml

(TBD)

README.md

This is the root-level file with information about the package itself. You are free to define the structure and contents of the file.

Other Files

You are free to add other root-level files for purposes not used in this skeleton.

Scripts

A script, in Composer's terms, is either a PHP callbacks or any command-line executable command. They are defined in the root composer.json package and are useful for executing a package's custom code or package-specific commands during the Composer execution process.

Contributing

See CONTRIBUTING.md