Skip to main content

Build awesome PHP web applications using Known as a framework

4 min read

You probably know Known as a simple web tool that lets you publish on your own site and syndicate across the web. It's also a great way to get a PHP web application up and running quickly and easily.

A quick, non-technical overview

Known is designed to make it easy to build an application without worrying about how your data is stored in the database, and takes care of a lot of really common tasks like user creation, logging in and logging out, and creating APIs. That way you can spend your time building the things that are unique to your application, knowing that everything else is dealt with.

One reason that's useful is that sometimes developers need to be able to make a working prototype very quickly in order to test an idea. Known gives you a full framework to play with, which removes the need to worry about infrastructure decisions. Furthermore, its plugins can be used by application developers to add features like Facebook integrations.

Technical details

Here are a few of the technical characteristics of Known as a platform that make it useful for developers.

  • The entire codebase is namespaced and object-orientated
  • It has a great MVC framework with flexible templating
  • Data is abstracted: use your choice of database engine
  • Plugins make integrations simple

Let's go through those in detail:

100% namespaced, object-orientated back-end, with MVC

PHP started as a procedural language, and many PHP-based projects have inherited this legacy. Known is fully object-orientated with namespaces, and is PRS-0 compliant.

It contains object primitives for things like entities (objects you can store), pages (endpoints that can be accessed using a web browser or other application), users and events. You can pick those up without ever having to use Known's front-end, but you can also use its fully-granular templating engine.

If you want, you can also use Known's page routing engine, which allows you to assign URLs to their controllers using regular expressions. Known pages include support for CSRF prevention, and can be used as an API endpoint out of the box.

The template types in Known can easily be toggled, so while Known ships with a responsive HTML interface out of the box, you could use Known as an API back-end and talk to it entirely in JSON.

Data abstraction

Out of the box, Known supports MySQL and MongoDB database back-ends. To the best of our knowledge, it's the only platform that lets you flip between these interchangeably. That's already cool, but because the database management layer is extensible, it's easy to build support for other platforms. Database engines like Postgres or CouchDB wouldn't be a stretch.

Dealing with database objects is super-easy, too. For example, to create a new blog post, you'd extend the Entity class:

namespace MyPlugin;

class BlogPost extends \Idno\Common\Entity {
    // Any custom logic

Then you can add arbitrary data to the object:

$post = new \MyPlugin\BlogPost();

$post->title = "This is my post title";
$post->body = "Some body text";
$post->mood = "Happy";
$post->tags = ['tag one','tag two','tag three'];
$post->arbitrary_metadata = "Arbitrary value";

To save it, you just need to call the save method:


The framework will take care of saving in an appropriate format, regardless of data back-end. Known takes care of the schema, so there's never any need to make your own tables. That also means that you can upgrade the framework without ever having to worry about data migration.

A great plugin framework

The same plugins that make it easy to syndicate content to Twitter and Facebook, for example, can also be used as development libraries. There's no need to create your own social media integrations, even if you're building an application with a very different core use case to Known. You can tell the system to programatically load the plugin, and then access its easy-to-use methods to authenticate a user with the network and call its APIs.

Permissive license

Known is available under an Apache license. You can always get the complete source code on GitHub.

And more!

Known's features also include features like a robust event framework, support for microformat parsing, search, and a web client with full proxy support. There's a lot to play with, and it's growing all the time.

And of course, you can get a free Known site here.