Laravel Package Creation Troubles

Published December 20, 2024 • 2 min read

Updated December 20, 2024

Author James Nicholls

Blog Image

It works on my machine, but the migrations are loading on the server, the components are creating 500's but why.

Being a developer newbie, I can manage with PHP, HTML, CSS and despite its absence on this site my JavaScript is also in good order. Just don't ask me to understand servers and databases and all the many intricacies that go with them.

Are you using Laragon, it's removes management of database and sever on local machine. It makes things easy, I've tried Docker and it just couldn't get it to work. It turns out that having a local server match the setup of live server is a good idea. It turns out capitalisation is import on Linux, not so much 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 false sense of security, this 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 get confusing quickly.

Imagine having to work your way through two different folders to ensure the capitals are in the correct places.

About the Author

Author Avatar

James Nicholls

Digital Marketer, Ecommerce Specialist who knows a little about making a websites work for businesses

View LinkedIn Profile →

Share This Post

Related Articles

Related Post

Related Article 1

Related Post

Related Article 2