100% bespoke.0% excess.

Unlike most other frameworks that just combine a set of already existing tools, TwistPHP is wriiten from the ground up. Every class, module and template is written to work seamlessly with all the others.

Development is always ongoing and because it doesn't rely on anyone else's classes or code, updates, improvements and fixes can be deployed quickly and easily.

Logic. Presentation. Separated.

MVC the way it should be.

At the heart of TwistPHP is an MVC architecture which allows you to easily and beautifully organise your code. Gone are the days where you complicate your PHP and HTML. With TwistPHP, you can now throw away your PHTML files and separate your code out properly.

The /app folder

The app folder serves to keep all your project files separated from the framework. This makes it really easy to update TwistPHP without moving around a lot of files.

This is the place where all your site's models, views, controllers and resources live along with all the configuration files, cache files and logs. You can also add any hooks and overrides into the app folder which keeps all your project-specific code together.

public_html

app

Cache

Config

Controllers

Models

Packages

Resources

Views

twist

…

Models

TwistPHP allows you to have models which act as administrators for the content. Models are the classes that allow you to get, set and manipulate data from the database.

You can easily overwrite any of the built-in models to fully customise your projects without ever touching the core of the framework.

Views

The views in TwistPHP are HTML-like .tpl files. With a syntax inspired by CodeIgniter, view files can be included and nested within one another and use content provided by controllers to return data to the user.

To keep your PHP and HTML separate, but still reusable, views can also be PHP files to house logic like for loops and data manipulators.

TwistPHP provides you with several useful functions to use in template tags which require you to write less PHP. It also gives you the ability to write ternary operators to reduce PHP further.

Controllers

The classes that get model data into views based on the request are the controllers. Controllers in TwistPHP allow you to respond individually to the four standard HTTP verbs (GET, POST, PUT and DELETE) as well as providing global responses for any request.

In addition to this, you can catch and pass variables from the URI into the controllers which allows you to make fully RESTful projects.

Resources

TwistPHP comes with a whole host of useful third-party resources such as jQuery, Modernizr, Font Awesome and Unsemantic as well as some custom tools like a JavaScript AJAX class that works perfectly with our AJAX controller.

The resources are really easy to include in your views as well. To include a copy of jQuery, simply use the tag &lbrace;resource:jquery&rbrace;. You can use a second parameter of async, defer or inline to include the resource in a number of different ways. Smilarly, you can use &lbrace;js:...&rbrace; and &lbrace;css:...&rbrace; to include JS and CSS files from your app folder.

RESTful routing.

The road to simplicity.

Beneath the surface of TwistPHP lies a powerful and expandable routing engine.

Included are several base controllers you can extend, allowing you access to prebuilt user controllers for login pages, registration forms, forgotten password prompts as well as AJAX controllers which allow you to build a full AJAX server.

Loads only what you use.

Faster loading.Reduced memory.

TwistPHP automatically optimises module loading for your specific purpose. When starting up, there are no instances of any models. As you start to use any functionality from the included models, instances are created and shared.

An instance of each shared model used is saved so it doesn't matter whether you use a model once or 100 times, there will only be a single instance.

This ensures that TwistPHP loads your project as quick as possible.

INSERT `beauty` INTO `queries`.

TwistPHP comes with its own database interactions — not too complex as to slow things down but powerful enough to cover nearly every query in your day-to-day code.

No more mysqli(), fetch_assoc() or mysql_real_escape_string(). Interacting with your database has now just become a whole lot easier.

TwistPHP database objects

Object-oriented database records make creating and modifying data in your tables really easy. Create or get a record, set its values and commit it to the database. Easy as 1-2-3.

Common query helpers

To aid you with quick and dirty queries, TwistPHP comes with several database methods for selecting, searching for and counting records, all of which return you objects (or optionally just an array) with the methods you need to modify and save back to the database.

Manage from anywhere.

Like any framework, major updates like functionality changes need to be done at a terminal. To make things easier for you, TwistPHP comes with a responsive web-based framework manager.

If it's updating your framework or .htaccess settings, clearing out your site's cache or enabling maintenance or development mode, the TwistPHP manager has you covered.

Easy authentication.

Trouble-free registrations, logins, permissions and sessions.

All the extra work that comes with login forms, authentication and sessions has already been taken care of. TwistPHP allows you to restrict areas of your project to certain user levels, create login and registration pages as well as handling basic things like the forgotten password functionality.

As part of the authentication system, TwistPHP provides you with a device manager which allows you to rename, remove access to and keep track of all your authenticated devices.