I was building PHPNomad’s documentation using Docusaurus when the thought struck me…
Wait a minute…why can’t PHPNomad make PHPNomad’s documentation site?
At Novatorius, our projects increasingly venture beyond WordPress. I recently shared how PHPNomad can function as an MVC framework with some configuration.
I’ve mentioned it a few times on this blog that once I started using PHPNomad, I realized that I want to use it for everything. WordPress plugins, apps, services…why not a static site, too?
After evaluating my initial Docusaurus setup, I realized this was entirely feasible. I just needed to implement a few key components that my MVC framework setup didn’t have yet:
- Support for routing from directory structures
- Markdown compilation
- A local server setup
- A command to compile static files
With these features in place, PHPNomad was ready to power its own documentation site.
There’s a few things that I particularly love about how this is set up.
- It does not need Node, or Webpack.
- The dependency stack is minimal compared to other setups. If you have PHP and Composer installed, you have what you need.
- It’s dead-simple to set up with GitHub pages
- Customizing the non-markdown content can use whatever template engine you want, including vanilla PHP if you want. I like Twig, so I used the Twig integration for this.
Now, that doesn’t mean you can’t use Webpack if you need some robust JavaScript or whatever, but for a basic documentation site? Is that really necessary? I don’t think so Instead, I opted to leverage Pico CSS with minor custom styling tweaks. The only JavaScript file is for syntax highlighting via Prism.
The actual script that compiles everything just uses PHPNomad, and is literally just calling a PHP script.The local server is just using PHP’s built-in webserver feature.
Real World Benefits
It’s wild to think about static site generation through the nomadic lens. We’re not just talking about another static site generator here – we’re talking about using the same exact patterns we use for everything else to build documentation.
Think about that for a second. Most documentation solutions are like “Hey, learn our special way of doing things!” But with this approach? If you know PHPNomad, you already know how to build and maintain the docs. The same strategies, the same templating, the same everything – just pointed at markdown files instead of database records.
The best part? I didn’t have to compromise on anything I love about modern documentation sites. I still get the clean URLs, the nice navigation, the markdown processing – all of it. But instead of learning someone else’s system, I’m using the same patterns I use everywhere else. That’s exactly what the nomadic approach is all about.
This means that anyone on my team at Novatorius has a pretty good baseline on how to maintain this repository. So, if there’s a problem, or something needs done to maintain it, I have a much wider range of people who can help. It’s not this awkward codebase that is totally different from what I build in every day, it’s using the same patterns I’m using everywhere else.
It’s a perfect example of what gets me so excited about PHPNomad. Once you have these patterns down, you can just… use them. For anything. Dynamic sites? Check. WordPress integration? Done. Static documentation? Why not! It’s all just PHP doing what PHP does best – getting stuff done.
Looking Forward
I’ve made the repository public, and I’m considering turning a version of it into a GitHub template, similar to the MVC app template.
The ability to develop in a consistent environment, regardless of the final deployment platform, continues to validate PHPNomad’s approach. As I’ve often said, once you get comfortable with PHPNomad, you want to use it everywhere. The consistency in patterns and methodology across different types of projects is invaluable.
You can see the repo for PHPNomad’s static site generator here.
Leave a Reply