- Laravel
- Java Spring
- Microservices
Integrating Laravel with Java Spring Microservices
How I connected a Laravel HRMS to Spring services for employee reports and mail notifications, and what I learned about keeping the contract between them clean.
Kimlong KUN6 min read
When we built the HRMS at ALLWEB, the core app lived in Laravel, but reporting and mail notifications were better suited to separate Java Spring services. This post walks through how the two talk to each other.
Why split the work?
Report generation is heavy and slow. Moving it into its own Spring service kept the Laravel app responsive and let us scale the two independently.
- Laravel owns users, employees and the admin UI
- Spring builds reports and sends mail
- Both share a clear REST contract
Calling the service from Laravel
$response = Http::withToken($token)
->post(config("services.reports.url") . "/reports", [
"employee_id" => $employee->id,
"month" => $month,
]);Agree on the contract first; the code on both sides gets simpler.