1. Go to this page and download the library: Download yaknet/dynlink 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/ */
yaknet / dynlink example snippets
namespace MyPlugin;
use YakNet\DynLink\Attributes\YdlExport;
use YakNet\DynLink\Attributes\YdlService;
#[YdlExport("Calculator")]
#[YdlService("Calculator")]
class Calculator
{
public function sum(float ...$nums): float
{
return array_sum($nums);
}
}
use YakNet\DynLink\DynLink;
use YakNet\DynLink\Security\Ed25519Signer;
DynLink::pack('./src/MyPlugin', './build/MyPlugin.ydl', [
'compression' => 'gzip',
'fusion' => true,
'optimize' => true,
'signer' => new Ed25519Signer(),
'private_key' => $privateKey
]);
use YakNet\DynLink\DynLink;
$result = DynLink::profile('build/MyPlugin.ydl');
print_r($result['profile']->toArray());
bash
# Run unit tests
composer test
# Run PHPStan static analysis (Level 9 - Maximum Strictness)
composer analyze
# Run benchmark suite
php example/benchmark.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.