PHP Identicon 라이브러리 설치

PHP Identicon 라이브러리 설치

1 사전작업[ | ]

2 CLI 예시[ | ]

testuser@localhost:~$ mkdir project1
testuser@localhost:~$ cd project1/
testuser@localhost:~/project1$ composer require yzalis/identicon:1.2.0
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing yzalis/identicon (1.2.0): Downloading (100%) 
Writing lock file
Generating autoload files
testuser@localhost:~/project1$ vi test.php
<?php
require 'vendor/autoload.php';
$identicon = new \Identicon\Identicon();
$imageData = $identicon->getImageData('bar');
file_put_contents('bar.png', $imageData);
testuser@localhost:~/project1$ php identicon_test.php 
testuser@localhost:~/project1$ ll bar.png 
-rw-rw-r-- 1 testuser testuser 250 Jul  1 13:46 bar.png
  • 트러블슈팅: PHP Fatal error: Uncaught Exception: GD does not appear to be available in your PHP installation. 나오면 php-gd 설치

3 웹서버 예시[ | ]

testuser@localhost:~$ cd /var/www/html/
testuser@localhost:/var/www/html$ composer require yzalis/identicon:1.2.0
... (생략)
testuser@localhost:/var/www/html$ vi identicon_test.php
<?php
include 'vendor/autoload.php';
$identicon = new \Identicon\Identicon();
$identicon->displayImage('foo');

4 같이 보기[ | ]

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}