1. Go to this page and download the library: Download webshr/core 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/ */
webshr / core example snippets
// functions.php or your theme's bootstrap file
use Webshr\Core\Bootloader;
// Initialize the framework
$bootloader = Bootloader::get_instance();
$bootloader->boot();
use function Webshr\Core\app;
// Get the application instance
$app = app();
// Resolve services from the container
$encryption = app('encryption');
$assets = app('assets');
use Webshr\Core\Application;
$app = new Application();
// Bind services
$app->instance('my-service', new MyService());
// Resolve services
$service = $app->make('my-service');
// Register singletons
$app->singleton('database', Database::class);
use Webshr\Core\Module;
class MyModule extends Module
{
public function register(): void
{
// Register WordPress hooks, services, etc.
add_action('init', [$this, 'init']);
}
public function boot(): void
{
// Boot logic after registration
}
public function can_register(): bool
{
return true; // Conditional registration
}
}