Introducing Navsmith

Sun, Aug 18, 2024

I finally got around to publishing my first open source package for Laravel. It’s called Navsmith, and it was born out of some common logic I found myself duplicating across projects.

Why did I build this? What does it do?

I recently created a website for my wife, who is a traditional artist/painter, and she wanted something with simple navigation much like this site itself. The bit of duplicated logic across her site and this one is a way of marking certain Laravel routes as belonging to the front end navigation structure, and then rendering the HTML/Blade syntax dynamically rather than hardcoding the URLs or having to remember certain route prefixes.

In addition, I found myself duplicating some logic that checked for the current page the user is visiting and then changing the styling of the navigation link corresponding to that URL accordingly, so as to create a SPA-like experience (this ended up being especially effective in conjunction with Livewire). All in all, I thought these were some handy features that I could package up, reuse, and that might even be helpful to some other Laravel developers.

If you’re interested in checking it out, head over to the Github repository for usage details and installation instructions. Please note that this first release, 0.1.0, is considered a development release.

Features for the future

Some features I’ve been knocking around ideas for include:

  • Adding support for child/nested navigation items.
  • Allowing for the string transformation function to be customized (right now only title case is supported).
  • Adding different formats of Blade/HTML rendering.

If you’d like to contribute to making one or more of these a reality, head over to the project’s contribution guide.