Skip to content

WPFluent Framework ​

WP Social Ninja is built on WPFluent (vendor/wpfluent/), a Laravel-inspired micro-framework for WordPress plugins. It lives under the WPSocialReviews\Framework\ namespace and provides:

  • A service container (Application extends Container) with binding/singletons and auto-resolution.
  • HTTP routing for the WordPress REST API (Framework\Http\Router).
  • Controllers, policies, and requests (Framework\Http\*).
  • An Eloquent-like ORM and query builder for the wpsr_ tables.
  • A migration runner (database/Migrations/, classmap autoloaded).
  • Support utilities (Framework\Support\Arr, collections, etc.).

Why a framework? ​

Instead of scattering add_action, $wpdb, and register_rest_route calls throughout the plugin, WPFluent centralizes them:

Raw WordPressWPFluent equivalent
register_rest_route()$router->get()/post()/... in api.php
$wpdb->get_results()Review::where(...)->get() (ORM)
add_action()/add_filter()$app->addAction()/addFilter() and hook handlers
Manual capability checksPolicy classes (->withPolicy('AdminPolicy'))
dbDelta() on activationMigration classes in database/Migrations/

Key namespaces ​

  • WPSocialReviews\Framework\Foundation\Application — the container / app instance.
  • WPSocialReviews\Framework\Http\Router — REST route registration.
  • WPSocialReviews\Framework\Http\Controller — base controller.
  • WPSocialReviews\Framework\Support\Arr — array helpers used across the app.

Configuration ​

Framework configuration lives in config/:

  • config/app.php — application config, including the REST namespace and version:

    php
    'rest_namespace' => 'wpsocialreviews',
    'rest_version'   => 'v2',

    This is why every endpoint is served under /wp-json/wpsocialreviews/v2/… — see REST API.

  • config/database.php — database configuration.

WP Social Ninja Developer Documentation