C0re

php lib

Core

php developer library

Core is a library of php classes to use in your applications. It is an attempt at a portable toolbox for rapid web development — a middle layer between the core php language and the project you're tasked to complete.

It is not a framework by the traditional definition. [1] [2]

(Roughly, ) A library is code that you include and use.
With a framework, it will include and use your code.

This lets you use (or ignore) Core as little or as much as you want. It can be compared to PEAR as a concept, but without the portability hassles (imho). In fact, Core has/uses a small number pear classes directly from the repos as dependencies for other classes ( Math_BigInteger, for example, for the BigInt_Bigmask class).

req() is the static class-loading method.
Core::req("Tpl");
 # requires cls/presentation/tpl/Tpl.class.php

Core::req("Dir", "ImageResize");
 # requires cls/data/files/Dir.class.php and
 # requires cls/business/imaging/ImageResize.class.php

That's pretty much it, but participating classes are sure to Core::req() their own dependencies, and most importantly, be prepared to have encounters with other Core classes.

Isolation

Core should be isolated from your application. On a shared server, Core could exist in /var or /etc, or as a user possibly. It's important that Core draw from it's own repo to receive updates an fixes. Copying Core directly into your projects defeats the point of having reusable code.

In return, Core will attempts to take care of itself through a repo and unit testing. There is a Core class, and its purpose is basically a class loader. You tell it what you want, and it provides (or dies trying). Unit test coverage is increasing regularly, and it talked about here.

Categories

Because of its size, Core classes were immediately divded into three major categories:

cls/data
cls/business
cls/presentation

It's not MVC, but it does help make it easier to find something, .. which you don't have to do. As Core is a class loader, you really only need to transverse the categories if you really need to see the underlying code for the class or trace its lineage.

Some categories may touch on the same topics, depending on the nature of the task. Like xml.

cls/data/xml/*   # for parsing xml files as data
cls/presentation/xml/* # for writing or providing xml