2017 © Pedro Peláez
 

project php-random-avatar

A simple service which delivers a random avatar image as the response for GET request.

image

danielsitek/php-random-avatar

A simple service which delivers a random avatar image as the response for GET request.

  • Wednesday, July 19, 2017
  • by danielsitek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Dependencies Build Status Code Climate Codacy Badge, (*1)

README

Introduction

Php-Random-Avatar is a simple service which delivers a random image as the response for GET request. It's a small personal project, built just for fun, learning and experimenting with PHP., (*2)

Usage

Example

File: app.php, (*3)

$avatar = new App\Avatar();
$router = new App\Router($avatar);

$avatar->set_image_root( __DIR__ . '/images' );
$avatar->set_images_array( array(
    'man' => array(
        '/man/001.png',
        '/man/002.png',
        '/man/003.png',
        '/man/004.png',
        '/man/005.png'
    ),
    'woman' => array(
        '/woman/001.png',
        '/woman/002.png',
        '/woman/003.png',
        '/woman/004.png',
        '/woman/005.png'
    )
) );

if ( in_array( @$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'] ) ) {
    $router->run();
} else {
    $router->use_https()->run();
}

Clone this repository to your server/localhost and open it in your browser., (*4)

In browser, you can request avatar image like this:, (*5)

/ for random image from any category., (*6)

/man for random image from the "man" category., (*7)

/woman for random image from the "woman" category., (*8)

License

For more information, see http://opensource.org/licenses/MIT or the accompanying MIT file., (*9)

The Versions

19/07 2017

dev-master

9999999-dev

A simple service which delivers a random avatar image as the response for GET request.

  Sources   Download

MIT

The Requires

 

The Development Requires