Giter Site home page Giter Site logo

mundschenk-at / jdenticon-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmester/jdenticon-php

0.0 3.0 0.0 126 KB

PHP library for generating identicons as PNG and SVG.

Home Page: https://jdenticon.com

License: MIT License

PHP 100.00%

jdenticon-php's Introduction

PHP library for generating highly recognizable identicons.

Sample identicons

Build Status Total Downloads

Features

Jdenticon-php is a PHP port of the JavaScript library Jdenticon.

  • Renders identicons as PNG or SVG with no extension requirements.
  • Runs on PHP 5.3 and later.

Live demo

https://jdenticon.com

Getting started

Using Jdenticon is simple. Follow the steps below to integrate Jdenticon into your website.

1. Install the Jdenticon Composer package

The easiest way to get started using Jdenticon for PHP is to install the Jdenticon Composer package.

composer require jdenticon/jdenticon

2. Create a php file that will serve an icon

Now create a file that you call icon.php and place it in the root of your application. Add the following content to the file.

<?php
include_once("vendor/autoload.php");

// Set max-age to a week to benefit from client caching (this is optional)
header('Cache-Control: max-age=604800');

// Parse query string parameters
$value = $_GET['value'];
$size = min(max(intval($_GET['size']), 20), 500);

// Render icon
$icon = new \Jdenticon\Identicon();
$icon->setValue($value);
$icon->setSize($size);
$icon->displayImage('png');

3. Use icon.php

Open up your favourite browser and navigate to http://localhost:PORT/icon.php?size=100&value=anything. An identicon should be displayed. Try to change the url parameters to see the difference in the generated icon.

Other resources

API documentation

For more usage examples and API documentation, please see:

https://jdenticon.com/php-api.html

License

Jdenticon-php is released under the MIT license.

jdenticon-php's People

Contributors

dmester avatar

Watchers

James Cloos avatar Der Mundschenk & Compagnie avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.