Download the PHP package tekintian/pinyin_utils without Composer
On this page you can find all versions of the php package tekintian/pinyin_utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pinyin_utils
PHP 汉字转拼音工具
目前最全面的汉字词典
包含20902个基本汉字+5059生僻字
使用方法:
- 载入本工具类
composer require tekintian/pinyin_utils
- 使用本工具
We give the same namespace Acme to all of the classes in the src/ directory. c. Point the namespace to the src/ directory in the composer.json file . We point the directory that holds the classes to the namespace in the composer.json file. For example, this is how we specify in the composer.json file that we gave the namespace Acme to the classes in the src/ directory:
{
"autoload": {
"psr-4": {
"Acme\\":"src/"
}
}
}
-
We use the psr-4 key.
The namespace Acme points to the src/ directory. The namespace has to end with \. For example, "Acme\". You can replace the generic Acme with the name of your brand or website.
d. Update the Composer autoloader:
$ composer dumpautoload -o
e. Import the namespace to your scripts. The scripts need to import the namespace as well as the autoloader, e.g., index.php:
b. Use the namespaces in the scripts:
<?php
require "vendor/autoload.php";
use Acme\Db;
use Acme\User;
use Acme\Pages\Page;
$page1 = new Page();
Conclusion
As we demonstrated in the last two tutorials, Composer is a powerful tool that can help us to both manage and autoload our own classes as well as others. Now, that we have such a powerful tool under our belt we're entitled to fully enjoy the best that modern-day PHP has to offer!
https://phpenthusiast.com/blog/how-to-autoload-with-composer https://phpenthusiast.com/object-oriented-php-tutorials