Laravel Package Development Troubles
Published December 20, 2024 • 2 min read
Updated September 27, 2025
Author James Nicholls
It works on my machine, but the migrations are loading on the server, the components are creating server errors, but why?
Being a developer newbie, I can manage with PHP, HTML, CSS and JavaScript, Blade + Alpine JS in case you're wondering. Just don't ask me to understand servers and databases, and all the many intricacies that come with them.
Are you using Laragon, it's removes the management of the database and server on local machines. It makes things easy, I've tried using Docker and couldn't get it to work. It turns out that having a local server that matches the setup of a live server is a good idea. I will have to revisit it soon to spot any issues. Like capitalisation being important on Linux, but not so much on Windows.
Loading The Migrations, Views & Components
The differnce between __DIR__ . the rest of your path, to basePath('the relative path to your files?'). This is important, one a generic the other is Laravel helper, and it also plays nicer with my server setup, both worked on local but only one did in production.
Linux servers tend to be case sensitive; be consistent.
Going from a local environment where capital and lowercase caused no issues lulled me into a false sense of security, this is true for all development work.
class BlogServiceProvider extends ServiceProvider
The service provider binds the package to Laravel. It is responsible for registering the package the boot() method will hold references to the views, routes and migrations.
Using the Laravel helpers loadRoutesFrom, loadViewsFrom, component Namespace, publishes & loadMigrationsFrom will become second nature. Most of these can take an array, but you probably shouldn't, having two places to store these files gets confusing quickly.
Imagine having to work your way through two different folders to ensure the capitals are in the correct places.