DEV Community

Mobeen Ahmed
Mobeen Ahmed

Posted on

manifest.json on a PHP site: name, icons, and theme-color in an afternoon

I run a small video downloader site, ramrom.io, built in plain PHP on shared hosting. No framework, no build step, no Node.js. One afternoon I decided to make it installable — the kind of thing where a visitor on Android can tap "Add to Home screen" and get an app-like icon instead of a bookmark. The whole job turned out to be one JSON file, two icons, and three lines in the page head.

The manifest is just a JSON file

A web app manifest is a small JSON file that tells the browser how your site should behave when it is installed. The browser reads it once, when it decides whether to offer the install prompt. The fields that matter for a simple tool site are few:

{
  "name": "RamRom — Video Downloader",
  "short_name": "RamRom",
  "description": "Download videos from TikTok, Instagram, Facebook and YouTube, free, no sign-up.",
  "start_url": "/",
  "display": "standalone",
  "background_color": "#ffffff",
  "theme_color": "#2563eb",
  "icons": [
    { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
    { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png" }
  ]
}
Enter fullscreen mode Exit fullscreen mode

name is the full name shown on the install prompt. short_name is what appears under the icon on the home screen, so keep it short — anything longer than about twelve characters gets cut off. display: "standalone" hides the browser chrome when the app opens, which is what makes it feel like an app instead of a tab. theme_color colours the address bar and the splash screen; I matched it to the site's blue, #2563eb, so the whole thing looks like one product.

Serving it from a PHP site

Because the site is plain PHP with no router, the manifest is a static file at the root: /manifest.json. Nothing in PHP needs to touch it. The only PHP-side work is the link in the page head, which I added to every page through the shared header:

<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#2563eb">
Enter fullscreen mode Exit fullscreen mode

The theme-color meta tag matters even for visitors who never install anything — it colours the address bar on Android Chrome on every visit.

One thing I checked after uploading: the server has to serve the file as application/manifest+json. On shared hosting you cannot always change the server config, so I added a line to .htaccess to be safe:

AddType application/manifest+json .webmanifest .json
Enter fullscreen mode Exit fullscreen mode

Chrome is forgiving about the MIME type, but being explicit costs nothing.

The icons: two sizes, no more

The manifest needs at least one icon at 192x192 and one at 512x512. I made both from the same source image, exported as PNG, and kept the design simple — a flat blue rounded square with a white download arrow. A photo or a busy logo turns to mush at 192 pixels, and Android applies its own mask, so keep the important detail well inside the frame.

My first attempt looked fine on desktop, but the installed icon on my phone was cropped. Leaving a margin around the artwork fixed it. Test on a real phone, not just in the desktop emulator.

What installability does not need

A lot of guides bundle the manifest with a service worker, and then bundle the service worker with offline caching, and suddenly a one-afternoon job is a week of work. You do not need any of that. Chrome's installability check wants a manifest and a service worker with a fetch handler, but the service worker can be a few lines that do nothing clever.

The manifest itself is not magic. It will not bring you visitors, and it will not make a slow page fast. What it does is small and real: a visitor who uses your tool every day gets an icon on their home screen, the site opens full-screen without browser chrome, and the splash screen matches your colours. For a free tool that people return to, that is a worthwhile afternoon.

If you run a plain PHP site and have been putting this off because it sounds like app development, it is not. It is a JSON file, two icons, and a link tag. Ship it, then check it on a real phone — that is where the mistakes show up.

Top comments (0)