PHP code example of perry-rylance / wordpress-class-factory

1. Go to this page and download the library: Download perry-rylance/wordpress-class-factory 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/ */

    

perry-rylance / wordpress-class-factory example snippets


namespace ExamplePlugin;

use PerryRylance\WordPress\Factory;

class Vehicle extends Factory
{
	public function name(): string
	{
		return "A generic vehicle";
	}
}

add_action('init', function() {

	$vehicle = Vehicle::createInstance();

	echo $vehicle->name();

	exit;

});