Is a nano web framework for PHP, like web.py for Python, Sinatra or Camping for Ruby.
It was forked by Harald Kirschner of Nice Dog (originally by Tiago Bastos).
require 'Tyke.php';
Tyke::register('/', array('Test', 'index'));
class Test extends TykeC
{
public function index() {
echo 'Hello';
}
}
Tyke::run();
If you want to build a small site or software and do not need a BIG framework with a lot of features, you can use Nice Dog. Nice Dog do not have any ORM or big features like Cake, Rails or Django have, but it is smaller, easier and faster!
Just get the .htaccess
and Tyke.php
and drop the files into a folder in your Apache server!
Tyke::register('/', array('Test', 'index'));
-
Get the files
-
Put in your htdocs directory, or a subdirectory.
-
Create a
index.php
-
Just
require('Tyke.php')
-
Make urls like this, define the url, class, method and HTTP method:
Tyke::register('tag/(?P<tag>[-\w]+)', array('Test', 'tag'), array('http_method' => 'GET'));
-
Write a class that extends
TykeC
class Test extends TykeC {}
-
Add a method
tag
public function tag($tag){ echo $tag; }
-
And dispatch Tyke magic
Tyke::run()
-
Open in your browser:
http://localhost/tag/dog
PHP works nice for templating, so lets use it!
public function tag($tag){
$this->tag = $tag;
$this->render('views/index.php');
}
<h1>My first example</h1>
<?=$content?>
To change base layout add to your method: $this->layout = 'myLayout.php';
<span><?= htmlspecialchars($tag) ?></span>
To run the samples, copy the .htaccess
in your favourite sample folder and change the RewriteBase
according to your absolute web path (e.g. /tyke/sample/simple/
if you load it via http://localhost/tyke/sample/simple/
).
See license file.