albertofem / kanjidic2-lib
PHP library to work with KANJIDIC2 kanji database
dev-master
2015-05-09 12:59 UTC
Requires
- php: >=5.3.0
- kanjidic2/kanjidic2: 2.0
- symfony/console: ~2.4
- symfony/event-dispatcher: ~2.4
This package is not auto-updated.
Last update: 2024-12-21 15:39:32 UTC
README
Requirements
PHP >= 5.3
Installation
In order to use this library on another project, you must add the kanjidic2 dictionary file as a Composer repository:
"repositories": [ { "type":"package", "package": { "name": "kanjidic2/kanjidic2", "version": "2.0", "dist": { "url": "http://www.csse.monash.edu.au/~jwb/kanjidic2/kanjidic2.xml.gz", "type": "file" } } } ],
Require this library using composer:
composer require albertofem/kanjidic2-lib
Install it:
composer update albertofem/kanjidic2-lib
Test everything is ok:
php vendor/albertofem/kanjidic2-lib/bin/kanjidic kanjidic:dictionary:show vendor/kanjidic2/kanjidic2/kanjidic2.xml.gz
You should see a large list of kanjis followed by the total count in the dictionary:
...
縉繁署者臭艹艹著褐視謁謹賓贈辶逸難響頻
Total dictionary entries: 13108
Usage
Create new Kanjidic instance:
<?php use AFM\Kanjidic\Kanjidic; $kanjidic = new Kanjidic("vendor/kanjidic2/kanjidic2/kanjidic2.xml.gz") $kanji = $kanjidic->lookByLiteral("世");
See Kanjidic
class for more lookup methods
License
This library is under the MIT license.