caret introduction

11
^, a self compiling PHP framework

Upload: j-b

Post on 17-Jul-2015

461 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Caret Introduction

^, a self compiling PHP framework

Page 2: Caret Introduction

Intro.

jeff = meta programmer

Page 3: Caret Introduction

I want my life (and the lives of my coworkers) to be … nice.

So I search for the silver bullet.

^ is my latest creation.

(yet another PHP web framework)

Page 4: Caret Introduction

^ is a simplified model of modern web practices written for basic PHP (with no OOP).

(basically is pure PHP with special hokey-pokey comments)

Page 5: Caret Introduction

Introducing the “Topology Compiler”

Page 6: Caret Introduction

page.user.php

<?php/*:[url1=users]:*//*:[url2=users/%id]:*//*:[url3=users/%id/%mode]:*//*:[url4=user-profile/%id/%first/%last]:*/?><html>...do stuff with $_REQUEST...</html>

/users?id=123&mode=edit = /users/123/edit

/users?id=123&first=Jeffrey&last=Barber = /uses-profile/123/Jeffrey/Barber

Page 7: Caret Introduction

Linking

<a href=”<? HrefGo(“page.user.php”,array('id' => '1')); ?> View User 1</a>

<a href=”<? HrefGo(“page.user.php”,array('id' => '1','mode' => 'edit')); ?> Edit User 1</a>

<a href=”<? HrefGo(“page.user.php”,array('mode' => 'edit') + $_REQUEST); ?> Edit Current User </a>

Page 8: Caret Introduction

Poof!SEO urls that will make your marketing guru

swoon!!!!

Page 9: Caret Introduction

How it works?

http://code.google.com/p/caret/

It's open source!

Page 10: Caret Introduction

if(!isset($_GET['_do_not_compile'])){ // Compile exec("./^compiler/step.1.sh > ^obj/__temp.js"); exec("js ^obj/__temp.js > ^obj/sitemap.php"); exec("./^compiler/step.2.sh > ^obj/__temp.js"); exec("js ^obj/__temp.js > ^obj/router.php"); exec("cat ^src/web.model.php ^compiler/engine.php ^obj/router.php > ^e.php");}

include("^e.php");

// did you just vomit a little on the inside? I did

Page 11: Caret Introduction

Development:RewriteEngine onRewriteRule ^[a-zA-Z](.*) \^c.php/$0RewriteRule ^$ \^c.php/

Production:RewriteEngine onRewriteRule ^[a-zA-Z](.*) \^e.php/$0RewriteRule ^$ \^e.php/