PlanetJon Platform

A lightweight modern PHP framework for developing websites and web-driven apps. Significant features include a fully object-oriented design, easy class auto-loading, plugin bundling and loading, and MVC support.

Table of Contents

Introduction

Incited by claims of PHP being a rubbish language, PlanetJon Platform started off as a proof-of-concept demonstrating that it is the coder rather than the language that produces rubbish code.

PlanetJon Platform is a modernized PHP framework that takes full advantage of Object-Oriented modelling and of the rich features that PHP provides. The platform offers, and encourages the use of, class autoloading, namespaces, plugin bundles, MVC support, and a very practical front dispatcher pattern. Please note that PlanetJon Platform requires a minimum of PHP 5.3

Getting Started

The PlanetJon Platform brings the concept of plugins to PHP. The core is a plugin that bootstraps itself, the components of the framework are plugins, your app should be developed as one or more plugins.

Creating a Plugin

A plugin, at the minimum, is a directory with a plugin manifest. A manifest is a simply a plaintext file with key:value; pairs. The fields name, id, and value are required but you can optionally specify a plugin activator class, and any dependancies for the plugin.

Note that the plugin id must match the directory name of the plugin and that dependancies are specified as comma separated plugin ids.

name: Example Plugin Manifest;
id: example-manifest;
version: 1.0;
activator: examplenamespace.Foo;
dependancies: dep1, dep2;

Adding Classes to a Plugin

Plugins are organized by sub-directories, much like Java packages. These sub-directories correspond directly to namespaces. Classes/interfaces must be defined in a namespace and be in a file of the same name, lower-cased, with a .php extension. It is best to have only one class/interface per file.

Plugin my-example, with a class Foo defined in file foo.php located in subdirectory example/namespace:

<?php
namespace examplenamespace;

class Foo {}
?>

Learning More

For now, the best way to learn more about using the PlanetJon Platform is by viewing the code for the demo plugin, which takes advantage of all the features currently included in PlanetJon Platform except for the XML parser.

Examples

Here’s how to set up the demo plugin. You can also view the demo in action.

  1. Download the PlanetJon Platform and the demo plugin
  2. Unzip PlanetJon Platform to some directory
  3. Edit pjp-init.php and set PJP_BASE_PATH to the fully qualified path where this file is located.
  4. Unzip the demo
  5. Place pjp.demo directory in the application directory in the PlanetJon Platform
  6. Place pjpdemo directory in your web path (public_html)
  7. Create a php file that will be used to access the demo or modify the existing index.php. It should look like this. Modify as necessary to include the PlanetJon Platform bootstrap.

<?php
//index.php

//Set to where the pjp init file is, in your PJP install.
include('./pjp/pjp-init.php');

//Load demo plugin
pjpcorepluginmanagementPJPPluginLoader::load('pjp.demo');
?>

Download

PlanetJon Platform is distributed “As Is” under the LGPL.