1. Go to this page and download the library: Download shimabox/pemojine library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shimabox / pemojine example snippets
SMB\Pemojine\Container as PemojineContainer;
use SMB\Pemojine\Structure\Vendor;
use SMB\Pemojine\Helper\Sentence;
// Create an instance of Google using a Container.
$pemojine = PemojineContainer::make(new Vendor\Google());
// Get the configured vendor name.
echo $pemojine->getVendorName(); // => Google
/*
|----------------------------------------------------------------------
| Get all BigGroups.
|----------------------------------------------------------------------
*/
$allBigGroups = $pemojine->getAllBigGroups();
// $allBigGroups is an array with a big group name in the key and an object(BigGroup) in the value.
foreach ($allBigGroups as $bigGroupName => $bigGroup) {
echo 'BigGroupName::' . $bigGroupName/* or $bigGroup->getName() */;
foreach ($bigGroup as $mediumGroupName => $mediumGroup) {
echo 'MediumGroupName::' . $mediumGroupName/* or $mediumGroup->getName() */;
foreach ($mediumGroup as $groupName => $group) {
// Output shortName.
echo 'Group::' . $groupName/* or $group->getName(), $group->getShortName() */;
// Output Emoji.
echo $group->output();
// Output HTML reference character. e.g) '😀', '🇯🇵'
echo htmlspecialchars($group->outputHtml(), ENT_QUOTES, 'UTF-8');
// Get unicode. e.g.) 'U+1F600', 'U+1F1EF U+1F1F5'
echo $group->getUnicode();
// Get unicode with removed blank. e.g.) 'U+1F600', 'U+1F1EFU+1F1F5'
echo $group->getUnicodeWithRemovedBlank();
// Get UTF8 string. e.g.) '\u{1F600}', '\u{1F1EF} \u{1F1F5}'
echo $group->getUtf8String();
// Get UTF8 string with removed blank. e.g.) '\u{1F600}', '\u{1F1EF}\u{1F1F5}'
echo $group->getUtf8StringWithRemovedBlank();
// Get aliases of shortName
$alias = implode(' ', $group->getAliasesOfName()/* or $group->getAliasesOfShortName() */);
echo htmlspecialchars($alias, ENT_QUOTES, 'UTF-8');
}
}
}
/*
|----------------------------------------------------------------------
| When selecting randomly from Big Groups.
|----------------------------------------------------------------------
*/
// Select a BigGroup at random
$randomBigGroup = $pemojine->randomFromBigGroup();
echo $randomBigGroup->getName(); // Randomly chosen BigGroupName.
// When acquiring a random group from narrowed down.
$groupOfBig = $randomBigGroup->getGroupAtRandom();
echo $groupOfBig->getName();
$alias = implode(' ', $groupOfBig->getAliasesOfName());
echo htmlspecialchars($alias, ENT_QUOTES, 'UTF-8');
echo $groupOfBig->output();
echo htmlspecialchars($groupOfBig->outputHtml(), ENT_QUOTES, 'UTF-8');
echo $groupOfBig->getUnicode();
echo $groupOfBig->getUnicodeWithRemovedBlank();
echo $groupOfBig->getUtf8String();
echo $groupOfBig->getUtf8StringWithRemovedBlank();
/*
|----------------------------------------------------------------------
| When selecting 'animal-mammal' in Medium Groups.
|----------------------------------------------------------------------
*/
// Select 'animal-mammal'.
$selectedMediumGroup = $pemojine->selectMediumGroup('animal-mammal');
echo $selectedMediumGroup->getVendorName(); // => 'Google'
echo $selectedMediumGroup->getName(); // => 'animal-mammal'
// $selectedMediumGroup is an iterator with a group name in the key and an object(Group) in the value.
foreach ($selectedMediumGroup/* or $selectedMediumGroup->getChildren() */ as $groupName => $group) {
echo 'Group::' . $groupName;
echo $group->output();
echo htmlspecialchars($group->outputHtml(), ENT_QUOTES, 'UTF-8');
echo $group->getUnicode();
echo $group->getUnicodeWithRemovedBlank();
echo $group->getUtf8String();
echo $group->getUtf8StringWithRemovedBlank();
$alias = implode(' ', $group->getAliasesOfName());
echo htmlspecialchars($alias, ENT_QUOTES, 'UTF-8');
}
// When acquiring a random group from narrowed down.
$groupOfM = $selectedMediumGroup->getGroupAtRandom();
echo $groupOfM->getName()/* or $groupOfM->getShortName() */;
$alias = implode(' ', $groupOfM->getAliasesOfName()/* or $groupOfM->getAliasesOfShortName() */);
echo htmlspecialchars($alias, ENT_QUOTES, 'UTF-8');
echo $groupOfM->output();
echo htmlspecialchars($groupOfM->outputHtml(), ENT_QUOTES, 'UTF-8');
echo $groupOfM->getUnicode();
echo $groupOfM->getUnicodeWithRemovedBlank();
echo $groupOfM->getUtf8String();
echo $groupOfM->getUtf8StringWithRemovedBlank();
// In the case of Medium Group, you can find a Big Group of parents.
$parent = $pemojine->selectMediumGroup('animal-mammal')->findParentGroup(); // => Parent BigGroup
assert($parent->getName() === 'Animals & Nature'); // => true
// The following are the same instances.
$a = $pemojine->selectBigGroup('Animals & Nature')->selectMediumGroup('animal-mammal');
$b = $pemojine->selectMediumGroup('animal-mammal');
assert($a === $b); // => true
// Exists?
assert($pemojine->hasMediumGroup('animal-bird') === true);
assert($pemojine->hasMediumGroup('piyo') === false);
/*
|----------------------------------------------------------------------
| Create sentences including Emoji.
|----------------------------------------------------------------------
*/
// Get an Outputter instance.
$outputter = $pemojine->getOutputter();
// Other ways to get instances.
/*
// Create an EmojiTable instance of Apple.
$emojiTable = new \SMB\Pemojine\Structure\Vendor\Apple\EmojiTable();
// Create an Outputter instance.
$outputter = new \SMB\Pemojine\Outputter\Outputter($emojiTable);
*/
// Create a Sentence instance.
$sentence = new Sentence($outputter);
// Sentence 1
$output_1 = $sentence->create('Hello U+1F1EFU+1F1F5 \u{1F601}:grin:|beaming face with smiling eyes|!!');
assert('Hello π―π΅ πππ!!' === $output_1);
echo $output_1;
// Sentence 2
$output_2 = $sentence->create('foo ::heart:: :bar:cinema:baz:');
assert('foo :β€: :barπ¦baz:' === $output_2);
echo $output_2;
// Sentence 3
$output_3 = $sentence->create('foo ||grinning face with big eyes|| |bar|face with tears of joy|baz|');
assert('foo |π| |barπbaz|' === $output_3);
echo $output_3;
$ php scraping/src/generator.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.