Simple PHP Pages - A simple puristic PHP Website Boilerplate

Overview

Simple PHP Pages - A simple puristic PHP Website Boilerplate πŸš€

Hey! This project provides simple and basic concepts for PHP pages. It includes ideas and samples for routing, pages, themes, layouts, components and portals. Just download it and use it as boilerplate for your next web project.

πŸ›  Included Utilities:

🧰 Features:

  • Included routing
  • Prebuild template structure
  • Override and extend template files
  • Build your own custom content blocks
  • Create your own pages
  • Working navigation example
  • Working contact form example (Without really mailing)
  • Works without any database
  • Included CSS Framework (Bulma) can easily switched
  • Prebuild 404 page

πŸ–Ό Preview:

preview

πŸ“• Quick start

Install

  1. Download or clone this repo
  2. Run composer install
  3. Copy the project to your webserver or use a local server (Below is a docker setup)

Create a new page

  1. Create a new page inside contents/pages
  2. Create a route to this page inside the index.php file
  3. Update themes/default/partials/navigation.php and add your page there

Create a new custom content element

  1. Add your components template inside themes/default/content
  2. Load your component inside your page template using the Component::create() method

🧭 Routing

Routing is done through simplePHPRouter. Just define additional routes inside of your index.php file like this:

Route::add('/user/([0-9]*)/edit', function($id) {
  echo 'Edit user with id '.$id.'<br>';
}, 'get');

🎨 Themes

Themes live in the themes folder. There is just one default theme at the moment. A theme consists of several Components (simplePHPComponents) and some assets like CSS and JavaScript files. The theme defines the markup of content elements, reusable particals like navigation and header and page layouts. Just extend the default theme or create your own.

The currently used theme is declared within the index.php file.

πŸ“„ Pages

A page is a instance of simplePHPComponents. It will act as some kind of a controller. A page defines its contents and will load a layout from the theme. Then the page will push the contents to the main content section of the used theme. Copy and create new pages if you want. Do not forget to create a route to your new page:

Route::add('/my-new-page', function() {
  Component::create('page/my-new-page')->print();
});

🧱 Content Blocks

Imagine blocks as stackable and reusable content templates that live inside the theme folder in themes/default/content. Every page will consist of one ore more of this blocks. A content block is also an instance of simplePHPComponents. Content blocks can be text, text with images, sliders, hero-elements, tabs, tables, etc. Simply print and reuse a content block by using Component::create():

Component::create('content/hero')->assign(['title' => 'Welcome', 'subtitle' => 'Lorem Ipsum'])

β–¦ Layouts

A layout is part of the current theme. A layout just describes the HTML markup around the contents. It defines the header, the body and the general alignment of the contents. Every page should load a layout first. Every layout is an instance of simplePHPComponents.

Component::create('layout/boxed')->assign([
  'title' => 'About',
  'subtitle' => 'Learn more about us',
  'lang' => 'en'
])->print();

πŸ•³ Portals

Portals will be used to throw contents to a defined point inside your app. For example a theme will somewhere inside open a contents-main portal. Using this Portal you can throw contents to there from any other point of your app. Read more about Portals: simplePHPPortals

Portal::send('contents-main', 'Hello World');

🚒 Test setup with Docker

I have created a little Docker test setup.

  1. Build the image: docker build -t simplephppages docker/image-php-7.4.1
  2. Spin up a container: docker run -d -p 80:80 -v $(pwd):/var/www/html --name simplephppages simplephppages
  3. Bash into the container with docker exec -i -t simplephppages /bin/bash and run composer install to install dependencys on first run
  4. Open your browser and navigate to http://localhost

License

This project is licensed under the MIT License. See LICENSE for further information.

You might also like...
The plugin generates posts/pages. Useful to generate millions of records in wp_posts table
The plugin generates posts/pages. Useful to generate millions of records in wp_posts table

KAGG Generator The plugin generates posts/pages. Useful to generate millions of records in wp_posts table. In WordPress development, sometimes it is n

A package to render form fields in WordPress settings pages.

WP Settings Page Fields A package to render form fields in WordPress settings pages. You might need a settings page with a form and its fields and you

Create eye-catching Open Graph images for each (or some) site pages
Create eye-catching Open Graph images for each (or some) site pages

Open Graph Image Generator for Laravel Create Open Graph images (og:image, twitter:image, vk:image) for each (or some) site pages. Use page title to c

Sync Wordpress Pages and Posts (even custom post types + fields) from static Markdown + YAML files

Sync Markdown Files to WordPress Posts and Pages Static site generators let you use a revision-controlled tree of markdown files to make a site, but d

A Magento 2 module that allows admins to duplicate CMS blocks and pages from their respective grids and en masse.
A Magento 2 module that allows admins to duplicate CMS blocks and pages from their respective grids and en masse.

element119 | CMS Duplicator πŸ“ Features βœ”οΈ Allows merchants to duplicate CMS blocks and pages from the Action column in the admin grid βœ”οΈ Allows merch

WooCommerce Empty Cart Button plugin helps you to add Empty Cart button to WooCommerce Pages/Sections using Shortcode only.

WooCommerce Empty Cart Button plugin helps you to add Empty Cart button to WooCommerce Pages/Sections using Shortcode only. How to use? Download the p

Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.
Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.

Laravel Blog Have you worked with Wordpress? Developers call this package wordpress-like laravel blog. Give our package a Star to support us ⭐ 😍 Inst

The Assure Alliance support website. This website is based on Questions2Answers and is a forum for support using Biblical Tools

The Assure Alliance support website. This website is based on Questions2Answers and is a forum for support using Biblical Tools

Owner
SteamPixel
SteamPixel
A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

null 16 Nov 11, 2022
A PHP/Laravel package to fetch Notion Pages and convert it to HTML!

Generate HTML from Notion Page This package converts all the blocks in a Notion page into HTML using Notion's API. For more details on Notion API, ple

Usama Rehan 4 Nov 23, 2022
Extracts information about web pages, like youtube videos, twitter statuses or blog articles.

Essence is a simple PHP library to extract media information from websites, like youtube videos, twitter statuses or blog articles. If you were alread

Essence 765 Dec 30, 2022
This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides.

Kirby 3 Many To Many Field This plugin allows you to create many-to-many relationships between pages in Kirby.

Jonas Holfeld 41 Nov 19, 2022
Allow SVG images to be used in Magento CMS blocks and pages via the TinyMCE Wysiwyg Editor.

HyvΓ€ Themes - SVG support for the Magento CMS Wysiwyg Editor Allow SVG images to be used in CMS blocks and pages via the TinyMCE Wysiwyg Editor. hyva-

HyvΓ€ 14 Dec 15, 2022
Pat if amp - ⚑ A Textpattern Conditional Plugin for Google's Accelerated Mobile Pages Project (AMP)

pat_if_amp Download | Packagist AMP pages for Textpattern CMS. This conditional tag examines the URL of the current page and determines if the URL end

Patrick LEFEVRE 4 Dec 15, 2019
Rah cache - Cache Textpattern's dynamic pages as flat files

rah_cache Packagist | Issues Rah_cache is a simple, experimental full-page caching plugin for Textpattern CMS. It caches Texpattern’s dynamic pages as

Jukka Svahn 2 Apr 24, 2022
This package provides a wrapper for Google Lighthouse to audit the quality of web pages with Laravel.

laravel-google-lighthouse This package is based on octoper/lighthouse-php. This package provides a wrapper for Google Lighthouse to audit the quality

Logiek 5 Jun 1, 2022
Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pages from the admin panel.

Magento 2 Preview/Visit Catalog Overview Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pa

Raj KB 4 Sep 27, 2022
Coder Metabox for WordPress - Create Pages, Posts Custom Meta Fields options

Coder Metabox for WordPress Coder Metabox for WordPress - Create Pages, Posts Custom Meta Fields options. Step 1 call coder-metabox.php file in functi

Ashikur Rahman 3 Feb 19, 2022