DEV Community

Discussion on: Refactoring #1: Using ternary and null coalescing operators in PHP

Collapse
abhinav1217 profile image
Abhinav Kulshreshtha

Not really, There is no good or bad practice. VueJS was something that Taylor Otwell personally liked and made laravel in tuned with it, but in practice, you can use anything for the front-end. I recently started migrating a laravel+vue app to laravel+svelte, and there is not much of a friction.

Then there is also a matter of architecture, For someone who is more comfortable with monolithic php, livewire might be better than anything, else. Some something light, Alpine.js is also popular. My application was API first designed with separate frontend server so switching front-end is simple.

Collapse
askoflor profile image
askoflor

my problem is the following I want to build a web application with reactjs for the background tend and laravel for the backend so to do it I want to separate it into two projects a reactjs project for the background tend and a laravel project for the backend I want it do in the perspective of obstructing application loading and SEO referencing so I would like to know if this is a good practice

Thread Thread
abhinav1217 profile image
Abhinav Kulshreshtha

Your approach is correct.
Make 2 projects, Laravel API, (or lumen) and a React frontend.

Serve React site (node server) on your-domain.com, and fetch data from api.your-domain.com will be your php-laravel endpoint.

Once you have done that, you can use server-side rendering ( and later a technique called hydration ) to your first load, that will help with SEO.
SEO is mostly related to what is served on front, so you need to work on SEO techniques on your react front-end. Depending on your need you might not need to do anything seo related in laravel api except for making sure http codes are proper.

Thread Thread
askoflor profile image
askoflor

thank you for your contribution