@fhoulbreque If this is migrating an existing vanilla PHP application to a framework like Laravel, then I’d just concentrate on migrating your application “as is” to Laravel first, before then adding “niceties” such as Livewire, Tailwind, Alpine, etc. The reason being, you want your application in a working state and not half-migrated to Laravel, half-using Livewire, half-using Tailwind, etc. You want confidence when re-platforming, especially when dealing with something as sensitive as accounts and financial data.
I’d tackle this by:
- Creating a new Laravel application.
- Renaming public/index.php to public/laravel-index.php or something.
- Dump your existing, vanilla PHP application inside the public directory.
- Updating the .htaccess file if using Apache, or your nginx site configuration, to check to pass any unhandled requests to your public/laravel-index.php file.
With the above, when a request comes in, what should happen is:
- Apache/nginx will first check the public directory for a file matching the request (i.e. https://example.com/some-old-script.php).
- If the file exists, it’ll be executed.
- If it doesn’t exist, the request will be passed to Laravel for handling. Laravel will then either successfully route the request, or throw a 404 if there is no matching route.
This means that you can work on re-platforming your application to Laravel piece by piece. Take a script, create a controller for it, delete the original script when you’re happy it’s working when being served by Laravel. Your public directory should slowly empty of “old” code, and your Laravel application should start growing with code converting from your vanilla PHP scripts to code in controllers.
As for the database set-up, it’s definitely unconventional. You’re basically describing a multi-tenanted application. And whilst one flavour of multi-tenancy sees a database per tenant, it’s odd to create a completely new database for each financial year as well. I don’t know how many customers you have, or how long the application has been running for, but that’s obviously going to lead to a lot of database.
Whether you go the database-per-tenant route, or a single database for all tenants and financial years, may be more a legislative choice to make than a technical one. You may need to check with your country’s laws on storing financial data, and whether it needs to be segregated from other customers’ financial data or not. It may also give your customers piece of mind knowing their data is walled away from other customers’. Nothing will ruin confidence in your application more than a customer logging in, and accidentally seeing other customers’ data due to a bug or misconfiguration.