Nexus Middleware
Built-in API Command Bridge
Nexus comes built right into Zenith — your intelligent middleware that connects, orchestrates, and automates API interactions. No external services, no additional setup.
Meet Nexus
Nexus is Zenith's built-in API orchestration middleware — seamless connectivity with minimal code, no external dependencies, and zero configuration.
Native Integration
Built directly into Zenith's core. It's ready when your application is.
Zero Configuration
Start calling APIs immediately. Auth, retries, and errors handled for you.
Enterprise Ready
Security, logging, and monitoring baked in from dev to production.
Engineered for Developer Happiness
Nexus brings powerful integrations into your app with elegant, readable code.
Email Service
Brevo/SMTP, retries, and debugging included.
HTTP Client
Guzzle-based, JSON parsing, robust error handling.
Object Storage
Local or cloud, metadata, and file ops.
Fluent Interface
Chainable, readable, and intuitive APIs.
Seamless by Design
Nexus isn't an add-on—it's woven into Zenith. Deep integration delivers speed, security, and simplicity.
Zero Latency
No extra hops—middleware runs in-process.
Shared Security Context
Credentials and policies remain within your app boundary.
Native Integration
Works directly with models and controllers.
Scales With You
From prototype to enterprise with no architectural shifts.
Traditional External Services
Zenith + Nexus Integration
Nexus in Action
Turn complex interactions into concise, maintainable code.
Email Notifications
Brevo/SMTP providers, retry & debug// Send welcome email using Nexus
public function sendWelcomeEmail(): array {
return Nexus::email()
->provider('brevo') // or 'smtp'
->from('[email protected]', 'Zenith App')
->to($this->emailAddress)
->subject('Welcome to Our Platform!')
->html('Welcome!
Thanks for joining us!
')
->send();
}
// Quick method
Nexus::sendEmail('[email protected]', 'Welcome!', 'Hello World
');
HTTP API Calls
Automatic JSON, headers, retries// GET with JSON parsing
$response = Nexus::http()->get('https://api.example.com/users');
// POST with auth
$result = Nexus::http()
->withHeaders([
'Authorization' => 'Bearer ' . $token,
'Content-Type' => 'application/json'
])
->post('https://api.example.com/orders', [
'product_id' => 123,
'quantity' => 2
]);
if ($result['success']) {
// handle success
}
Object Storage
Local or cloud with metadata// Upload file
$result = Nexus::storage()
->provider('local')
->path('/var/www/storage')
->put('uploads/avatar.jpg', $fileContent, [
'user_id' => 123,
'uploaded_at' => date('c')
]);
// Exists and metadata
$exists = Nexus::storage()->exists('uploads/avatar.jpg');
$info = Nexus::storage()->metadata('uploads/avatar.jpg');
// List with prefix
$files = Nexus::storage()->list('uploads/', 10);
Error Handling
Enable debug and catch exceptions// Enable debugging
try {
$result = Nexus::email()
->debug(true)
->provider('brevo')
->from('[email protected]')
->to('[email protected]')
->subject('Test Email')
->html('Testing Nexus
')
->send();
if ($result['success']) {
echo "Email sent successfully!";
}
} catch (NexusException $e) {
error_log('Nexus Error: ' . $e->getMessage());
}
Start Building Today
Nexus is ready the moment you install Zenith. No config, no setup—just build.
Your First Nexus Call
A simple example showing how easy it is to integrate services<?php
class UserController extends Controller {
public function welcome(): void {
$result = Nexus::email()
->provider('brevo') // or 'smtp'
->from('[email protected]', 'Zenith App')
->to('[email protected]')
->subject('Welcome to Zenith!')
->html('<h1>Welcome!</h1><p>Thanks for joining us!</p>')
->send();
if ($result['success']) {
Nexus::storage()
->provider('local')
->put('welcome-log.txt', 'User welcomed at ' . date('Y-m-d H:i:s'));
}
$this->render('welcome', ['success' => $result['success']]);
}
}
Nexus handles auth, retries, logging, and more—automatically.