logo

You don't always need to put Pennant in the database

The array driver keeps simple toggles lightweight

Aaron Saray
Aaron Saray
2026-09-01

Pennant defaults to the database driver, and most tutorials follow that lead. That's fine for long-lived flags, but it adds a row and a query for every feature resolution.

But what about those simple date-based toggles, or features that are deployed darkly but will be enabled by a config change later?

If that's all you have, choose the array storage configuration instead.

Then, you can still leverage the power of Pennant without the unnecessary weight of a database lookup. For example:

use Laravel\Pennant\Feature;

// Continuous deploy gate - flipped via config when we're ready to release
Feature::define('new-checkout', fn () => config('features.new-checkout'));

// Date-based toggle
Feature::define('holiday-banner', fn () => now()->between('2026-12-20', '2026-12-31'));

This isn't a knock on the database driver. For flags tied to user segments, or features that need to be altered through a UI, the database can be the right call. But for most other cases, I'd suggest going with the lighter weight array configuration.

Here to help,

Aaron

P.S. Feature flags are just one piece of shipping safely. If you want another set of eyes on your rollout strategy, schedule a call with us and we'll talk it through.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice.