1. Go to this page and download the library: Download stracker-phil/wpdi 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/ */
// src/My_Application.php
class My_Application {
public function __construct( My_Service $service, My_Logger $logger ) {
$this->service = $service;
$this->logger = $logger;
}
public function run(): void {
add_action( 'init', array( $this, 'on_init' ) );
}
}
// Very basic example. Read the "Configuration" doc for more options.
return array(
Logger_Interface::class => WP_Logger:class,
Cache_Interface::class => Redis_Cache::class,
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.