Skip to main content

11 posts tagged with "php"

View All Tags

Build a Chat Application with BowPHP + WebSockets

· 7 min read
Franck DAKIA
Principal maintainer

BowPHP is a request/response framework — it shines at HTTP: routing, validation, the Barry ORM, sessions. What it deliberately does not ship is a long-running WebSocket server, because keeping a socket open for every visitor is a different job from answering an HTTP request and moving on.

So the right architecture isn't "make BowPHP do WebSockets." It's: let BowPHP do what it's great at — validate and persist messages, and be the source of truth — and put a tiny, dumb socket.io server next to it whose only job is to fan messages out to connected browsers in real time.

That's exactly what we'll build: a small group chat where BowPHP owns the data and a ~30-line Node server owns the live connection.

Build a To-Do REST API with BowPHP: CRUD and JWT Authentication

· 7 min read
Franck DAKIA
Principal maintainer

We already covered the server-rendered To-Do list — HTML forms, sessions, the works. This time we'll build its API counterpart: a stateless JSON REST API where clients authenticate with a JWT and every task belongs to the user who created it.

By the end you'll have register/login endpoints that hand out a token, and a full set of CRUD routes that only ever touch the current user's tasks.

Using React and Vue.js Assets in a BowPHP Project

· 5 min read
Franck DAKIA
Principal maintainer

Most applications are mostly server-rendered HTML with a few islands of rich interactivity — a dashboard widget, a live search box, a multi-step form. BowPHP ships with a modern, Vite-powered frontend out of the box, so you can drop a React or Vue component exactly where you need one without turning your whole app into a single-page application.

In this post we'll wire up both: an interactive React counter and a Vue widget, mounted side by side into a server-rendered template.

Tutorial: Custom Commands and Scheduling in BowPHP

· 6 min read
Franck DAKIA
Principal maintainer

Most applications grow a handful of recurring chores: prune stale data, send a nightly digest, rebuild a cache. The clean way to handle them is a custom console command you can run by hand, plus the scheduler to run it automatically. In this tutorial we'll build one end to end and wire it up the right way.

By the end you'll have a data:prune command — with options, a dry-run mode, and friendly output — running every night in production, safely.

Building a Domain-Driven Design Architecture with BowPHP

· 6 min read
Franck DAKIA
Principal maintainer

BowPHP ships with a clean MVC layout, but nothing stops you from organising a larger application around Domain-Driven Design (DDD). The framework already gives you the three pieces DDD leans on: a container to bind interfaces to implementations, CQRS to model use-cases, and an event system to publish domain events. In this post we'll wire them together into a layered, testable architecture.

We'll model a single bounded context — Ordering — and keep the domain at the centre, framework details at the edges.

Speeding Up a BowPHP API with Caching

· 4 min read
Franck DAKIA
Principal maintainer

The fastest query is the one you never run. In this post we'll take a slow API endpoint and make it fast with the BowPHP cache — then keep the cached data correct when the underlying records change, and finish by adding a lightweight rate limiter. Everything here works the same whether you're on the file, database, or redis driver.

Splitting Orders and Billing with BowPHP Microservices

· 4 min read
Franck DAKIA
Principal maintainer

As an application grows, some responsibilities want to live on their own — their own deploy cadence, their own scaling, their own team. Billing is a classic example. In this post we'll extract billing into a separate service and have our Orders application talk to it using the bowphp/microservice package over Redis.

We'll use both communication modes the package offers:

  • Request/Response (RPC) with send() — when Orders needs an answer back.
  • Fire-and-forget (Event) with emit() — when Orders just wants to announce that something happened.

Add 'Login with GitHub' to Your BowPHP App with SOAuth

· 4 min read
Franck DAKIA
Principal maintainer

Asking users to invent yet another password is friction you don't need. In this post we'll add "Login with GitHub" to an existing BowPHP application using the official bowphp/soauth package — and then persist the authenticated user so the rest of the app can use it.

The exact same flow works for Google, Facebook, GitLab, Instagram, and LinkedIn: only the credentials change.

Why Choose BowPHP for Your Next Project

· 3 min read
Franck DAKIA
Principal maintainer

BowPHP is a lightweight, expressive PHP framework built around a simple idea: give you everything you need to ship real applications — and nothing you have to fight against. If you value a clean API, fast boot times, and a small surface area you can actually read end-to-end, BowPHP is worth a look.