Skip to content

danieleguido/microbe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

    Paris, 8 nov 2011

° 
 ° welcome to microbe, the lightest-weight pseudo mwc made with php.
 Basically, it tries to "emulate" Zend Framework mwc structure in a more
 'transparent' and 'easier' way. If you know how zend mwc works, you can skip
 this introduction.
 Like in Zend philosophy, in microbe the URL is the real protagonist, along with the
 redirection mechanism, of course, which transforms the 404 http error
 (the boring "not found" page) into a fully understandable route.
 An url like http://microbes.com/whois/me is more than a simply "friendly url":
 the server provides the full path which returns the "not found" error,
 and a appropriate script can use these information the rest. 
 (the path must not point to a real address!).
 The first part, "whois", point to a controller class that is able to understand
 the function defined by the "me" action part of the url.
 The example above may result in a user page...

 So, Microbe handles url redirection, class autoloader and a soft controller view architecture.

 

°° 
 ° requirements
 + php v.5+
 + a web server

° ° 
 ° how to SETUP microbe
 firstly, grab the code. Then put carefully on line, uploading 
 the files somewhere in your server.
 The basic structure of your mymicrobe.com/labs is:
 
 [] labs/
    + index.php
    [] microbe/

 of course both "labs" or "mymicrobe" here are for demo
 purpose, so you're free to use your own names.
 We will use the symbol %/ to represent microbe root directory.

°  °
 ° first run microbe
 This below is my microbe config under apache2. Basically it's a 404 redirect,
 with a dummy alias. of course you can use the 303 redirect, or .htaccess.
 Cfr. the labs/microbe/bootstrap.php file for more info.
 However, every "not found" page will be redirected to %/index.php,
 the file which will contain your favourite (and lonely) layout
 
 Alias /the-labs /home/daniele/public/labs/the-labs/microbe
 <Directory /home/daniele/public/labs/the-labs/microbe>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^.*$ /the-labs/index.php [NC,L]

        #ErrorDocument 404 /the-labs/index.php
        Order deny,allow
        Allow from all
 </Directory>


 The core of microbe is the bootstrap.php.
 In opur sample, there is an php "include ...bootstrap.php" at the very
 beginning of %/index.php file.
 point your browser at <mymicrobe.com/microbe>. you shoudl see a nice index.php
 welcome page. of course, if you changed the /microbe in your apache settings,
 or you would like to have right in your server root, you have
 to configure your microbe installation properly: the css won't work
 without configuration! See below.

°   °
 ° configure!
 The %microbe/configs.php file contains the basic defined const.
 Yous hould change the values according to your project.

 # URL related const. To be modified, as you like.
  define( "THE_URL", "/microbe" );
  define( "THE_MICROBE_URL", THE_URL ."/microbe" );
  define( "STATIC_URL", THE_MICROBE_URL ."/static" );
  define( "THE_MICROBE_DEFAULT_PAGE", "default/index" );
  define( "THE_MICROBE_404_PAGE", "404" );

°    °
 ° test the router
 point your browser at <mymicrobe.com/microbe/silly/url>
 You should see a wonderful picture and a bunch of verses.

°     °
 ° the fonts.
 Thanks to free font titillium, http://www.campivisivi.net/old/titillium/
 I dont' know if it's used according to the licence, http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL, but it's an awesome font.
 Many thanks to Cassia font, too.

°      °
 ° last but not least
 A full documented documentation will come soon. beware!

 The medialab Sciences Po staff

 


 

About

a php lite-weight model-view-controller basic structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published