Skip to content

A vanilla PHP module / Composer package boilperplate / template.

License

Notifications You must be signed in to change notification settings

elliotjreed/php-package-boilerplate

Repository files navigation

PHP Package Boilerplate / Example Project

This repository shows a basic setup for a PHP package or application in PHP.

PHP Versions

This version will work on PHP version 8.2 and above.

For a version which is compatible with PHP 8.0 and 8.1 select the 8.0 Git tag (github.com/elliotjreed/php-package-boilerplate/tree/8.0).

For a version which is compatible with PHP 7.4 select the 7.4 Git tag (github.com/elliotjreed/php-package-boilerplate/tree/7.4).

Getting Started

PHP 8.2 or above and Composer is expected to be installed on our system.

Installing Composer

For instructions on how to install Composer visit getcomposer.org.

Installing

After cloning this repository, change into the newly created directory and run

composer install

or if you have installed Composer locally in your current directory

php composer.phar install

This will install all dependencies needed for the project.

Running the Tests

All tests can be run by executing

vendor/bin/phpunit

phpunit will automatically find all tests inside the test directory and run them based on the configuration in the phpunit.xml file.

Testing Approach

The test for the class Greeting verifies that the return value of the sayHello method returns the string "Hello {name}", where {name} is the value passed through to the constructor.

Running the Application

PHP has an in-built server for local development. This can be started by executing

php -S localhost:8000 -t public

Then open your browser at http://localhost:8000/example.php

You should see the text "Hello Ada Lovelace" on your screen.

Built With

License

This project is licensed under the MIT License - see the LICENCE.md file for details.

About

A vanilla PHP module / Composer package boilperplate / template.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages