Quick Start

Installation & Set up

First, you need to Install Composer. This will add a new command composer or composer.phar. Once you’re done, use this command to create a new project. You can change your_project to anything you want.

composer create-project skyronic/crudkit-template your_project

This command:

  1. Creates a new folder called your_project with a skeleton project which includes a sample database, and a sample crudkit application.
  2. Downloads and installs the latest CrudKit library and dependencies
  3. Copies static files to static/

Usage with built-in server

cd path/to/your_project
php -S 0.0.0.0:8080

And open http://localhost:8080 in your browser. You can update the ports accordingly as required.

Usage with XAMPP

Copy the folder that was created inside your htdocs folder and open it in your browser.

Basic Concepts

The most important thing to know is that CrudKit works and behaves as a full web application, and has frontend and backend functionality.

  • A user can load a single CrudKit App in a browser, by visiting a URL.
  • A single app contains one or more pages. Usually a page will be mapped to a single database table for editing.
  • The functionality and behaviour of the App is configured using the CrudKit PHP API written by you, the developer.
  • You will not be controlling or writing any HTML. You simply use the API to configure the behaviour and the UI will be generated via CrudKit.

Structure of a CrudKit App in PHP

This is an basic CrudKit application.:

<?php
// Require CrudKit application
require "crudkit/crudkit.php";
use CrudKit\CrudKitApp;
use CrudKit\Pages\HtmlPage;

// Create a new CrudKitApp object
$app = new CrudKitApp ();

// Create a new Page, of type "HtmlPage" which allows you to display arbitrary HTML inside 
$page = new HtmlPage("mypage1"); // Every page needs to have a unique ID
$page->setName ("My First Page"); // setName is available for all pages.
$page->setInnerHtml ("This is page # <b>1</b>"); // You can set the HTML of this page, a feature supported by HtmlPage
$app->addPage ($page);

$page2 = new HtmlPage("mypage2");
$page2->setName ("My Second Page");
$page2->setInnerHtml ("This is page # <b>2</b>");
$app->addPage ($page2);

// Render the app. This will display the HTML
$app->render ();

?>

If you open this in the browser, you will see a simple app with a single page.

Built by Anirudh Sanjeev. CrudKit is distributed under the MIT/X11 License.