Building a Basehim App: Beginner-Friendly Developer Guide


Muhammadasif1142

Uploaded on Aug 18, 2026

Category Technology

Learn how to build modular Apps for Basehim, an open-source, modular PHP CMS. This practical guide takes developers from creating a basic App to building more advanced extensions with real-world examples and recommended development practices.

Category Technology

Comments

                     

Building a Basehim App: Beginner-Friendly Developer Guide

Building a Basehim App This guide explains how to build an App for Basehim, from a minimal app to a more complete app with custom content types, admin pages, hooks, database tables, settings, assets, permissions, upgrades, and packaging. It is written for beginners, but also serves as a practical reference for experienced Basehim developers. Companion documentation- APP-API.md — the $this->api() surface and API operations.- APP-PERMISSIONS.md — declaring and enforcing App permissions. --- 1. What is a Basehim App? A Basehim App is a modular extension that adds functionality to a Basehim website. An App can, for example: • Add a custom content type such as Events, Products, Courses, or Properties. • Add admin menu items and admin pages. • React to content, user, media, mail, and other system events. • Add routes and API endpoints. • Add editor scripts, styles, configuration, and block renderers. • Store its own settings. • Create and manage its own database tables. • Add CSS, JavaScript, images, and other assets. • Declare permissions. • Require a minimum PHP or Basehim version. • Depend on another App. • Run installation, activation, deactivation, upgrade, and uninstall logic. Think of an App as a self-contained feature package for Basehim. --- 2. Before You Start You should be comfortable with: • PHP basics • Classes and namespaces • JSON • Basic HTML • Basic SQL concepts • How Basehim is installed and accessed You do not need to understand every Basehim API before creating your first App. A good learning path is: 1. Create the App folder. 2. Create app.json. Basehim App Development Guide Page 1 3. Create the entry class. 4. Activate the App. 5. Add one feature at a time. 6. Read the API and permissions documentation when you need more advanced functionality. --- 3. App Directory Structure A basic App looks like this: content/apps/my-app/ app.json src/ App.php views/ assets/ css/ js/ images/ The important files and directories are: Path Purpose app.json App manifest src/App.php Main App entry class views/ Templates used by the App assets/ CSS, JavaScript, images, and other frontend assets Assets are served through Basehim's asset route. For example: /content/apps/my-app/assets/... Do not hard-code this path in your application. Use $this->asset() when generating asset URLs so your App also works when Basehim is installed in a subdirectory. --- 4. Your First App Let's start with the smallest useful App. Create: content/apps/hello-world/ Inside it, create: content/apps/hello-world/ app.json src/ App.php 4.1 Create the Manifest Create app.json: { "name": "Hello World", "slug": "hello-world", "version": "1.0.0", "description": "A simple example Basehim App.", "author": "Your Name", "vendor": "yourcompany", Basehim App Development Guide Page 2 "namespace": "YourCompany\\HelloWorld", "src": "src", "entry": "App" } The manifest tells Basehim what the App is called, where its PHP code lives, and which class should be loaded. 4.2 Create the Entry Class Create src/App.php: