Skip to content
Bill Lee edited this page Nov 11, 2017 · 6 revisions

ccPhp Overview

Another PHP Framework. I was frustrated by the steep learning curve needed for most PHP frameworks. The goal is provide a thin, simple orchestration of app flow while avoiding reinvention of key components by leveraging existing outside components when they already exist (e.g., Redbean, Smarty, LessCSS, etc.). The goal is to get you up and building web apps as quickly as possible, only knowing PHP. You can build complexity in, as needed, but it shouldn't be needed from the get-go.

Features

  • Programmatic approach to building web-apps. ccPhp does not attempt to define a templating language, your favorite can be added, as you wish.
  • No tie to where the web app is rooted (root or otherwise). This means that you can move it to different URLs without having to rewrite any code.
  • Lightweight and simple. There are few components to understand, but also includes helpers to minimize the amount of basic work you may need.
  • Very little is dictated about how to implement and organize an application. Most of ccPhp is put in place to provide help to ease the implementation of an application.
    • Choose which technologies you want to use and
    • Choose how you want to organize your application

Concepts

A web-page is simply the response to a browser's request for content. That is the essence of what ccPhp is built around. So, if you have done any

  • Page. Like old-school web pages, a page component generates content in response to a HTTP request.
  • Request. The information send to a server when content is being requested, most notably, the URL, but also the data the may accompany a URL.
  • Application. The common result provided to user's interactions with one or more pages.

The bulk of the behavior of a ccPhp-based application is in the page implementation(s).

That's it!

ccPhp Components

With those three concepts in mind, the primary components should immediately be clear.

  • ccPageInterface: PHP Classes based on this interface implement a render() method to generate the content in response to a request. ccPageInterface class implementations form the application-specific code.
  • ccRequest: An instance of this ccPhp class represents the characteristics of the current HTTP request.
  • ccApp: ccPhp operation is centered around a single ccApp object which manages the flow of an incoming request to ccPageInterface classes' render() methods. to generate content, to be returned.

Application Organization

There are three directories that go into every web-app:

  • Web-facing. "Public", web-facing directory (e.g., under htdocs, www, public_html, or wherever directory your server exposes
  • App-specific. Contains application-specific files. It could be a security risk to be directly web accessible because it could expose program code to the public.
  • ccPhp framework files

The web-facing directory contains the application's "anchor" (e.g., index.php) to direct the web-server to the app code. The file simply contains a reference to the app's starting file (app.php, in our sample). That starting file ties the app-specific code to the ccPhp framework by referencing ccApp.php.

File Organization

  • index.php -- (or whatever you want) and .htaccess (to send all processing to the PHP app-code). This file resides in the public facing area.
  • app.php -- (or whatever you want) is the configuration file is included by index.php file and should not be in the public facing area, so put it in the app-specific area.
  • ccApp -- The ccApp singleton instance that represents the infrastructure functionality of the app.
  • ccRequest -- The object representing the current request. It basically contains the state of the request.

In addition, there must be at least one PHP class which implements ccPageInterface::render() to create content for page requests.

Next, see Getting Started

Clone this wiki locally