Skip to content
Jonathan Baldie edited this page Jan 31, 2022 · 7 revisions

Welcome

I created this framework to show that PHP, while most definitely an imperative language, can be used to write code that conforms to a functional programming paradigm.

In plain English, that means the framework is built upon a foundation of pure functions. That makes it insanely fast to load pages, and easy to test, develop, and maintain new features.

But it goes counter to many of the principles we learn as junior developers: that object oriented is the only way, that everything needs to be a class, and that functions are too basic to use.

Experience has taught me that the best way to deploy production-ready code is to make your code easy to test. If our code relies too much on global state, and other code having ran first, then we are just guessing when we deploy it.

Functional programming isn't a silver bullet. But it solves both problems in a joyful way.


Problems? Look here

Here are some handy hints that may help you.

Use the composer create-project command written in the project's README.md file. It will generate an encryption key for you, and install all of the necessary dev dependencies. Only use git clone if you want to contribute to the framework.

I use my own PHP 8.1 image in production. But the CircleCI tests are performed with thecodingmachine/php:8.1-v4-cli so feel free to use that for your own work. In my experience the provider's images are very sound.

Don't mess around with .key once you've generated it. Especially if you've used it to encrypt values stored in your database.

I compiled the assets using yarn with node version 14. When I tried using the latest version of node to build the assets, it exploded in a hot mess of incomprehensible errors. I'm working on it! 😅

In production, this is how I compile assets without any problems:

docker run --rm -it -v (pwd):/app node:14 sh -c "cd /app && yarn install && yarn encore production"

Use the preinstalled phan/phan package to perform static analysis on any new code you write in your copy of the framework.

Yes, it can be annoying when a tool shouts judgemental complaints about your code, but I put it there for a reason! 🙂

Clone this wiki locally