Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

pfuhrmann/php-banner-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Banner Example

Installation

If you have docker and docker-compose installed than:

docker-compose up

Installing on bare metal (you need PHP 7+):

composer install

Requirements

Testing

Unit tests are provided in the /tests folder. To run these steps simply run following command from the project root:

bin/phpunit

Notes

  • Used newest version of PHP (7.1)
  • Tests implemented using PHPUnit 6 + including phpunit.xml config for easy execution
  • Autoloading classes by composer (PSR-4 standard)
  • Follows PSR-1, PSR-2 & PSR-4 guidelines
  • Utilized Carbon PHP library for easier and more reliable manipulation of DateTime
  • Made Allowed IPs configurable for each banner instance (on top of default ones as per specification)
  • Current DateTime for deciding whether banner is displayed is also configurable for each Banner::isDisplayable() call (more flexibility)

Future Improvements

  • Validate IP address format (with regex)
  • More options for the configuration
  • Accept directly Carbon classes in the Banner constructor or even better DisplayPeriod instance
  • More test cases possibly also with the data provider to cover multiple inputs with the same scenarios

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published