PHPフレームワーク ちいたん
ちいたんとは世界最軽量のPHP用MVCフレームワークです。
ちなみに私は普段CakePHPを使用していますが、
それを使用するほど大きなプロジェクトではなく、でも多少手のかかる物の場合に使えるフレームワークがほしい…
そんなときに使えるフレームワークを目指して作成しました。
ちなみにちいたんというのは制作者の奥さんの愛称です。
ライセンスはMITです。
ちいたん利用に関してのアンケートです。
http://enq-maker.com/fzfYXdj
ユーザー登録に関してのアンケートです。
アンケート
ほったらかしも申し訳ないのでちいたんの開発をご協力頂ける方を募集します。
もともとモチベーションのみで行っておりますので開発費は出ません。
ご興味のある方は以下より御連絡下さい。まずはSQLite対応から考えています。
お問い合わせ
新着情報
バージョン0.8.0.8公開。mysqlのポート指定バグ修正、バリデート仕様拡張。具体的な内容はバリデートマニュアルをご確認下さい。
バージョン0.7.9.9公開。MySQLのポート指定+バグfix、仕様拡張を行いました。具体的な内容はダウンロードページをご覧下さい。
CDBMysqlのconnectメソッドにバグがありました。$confirは$configの間違いです。
プロジェクトを登録できるようになりました。SourceForgeの様なサーバースペースはありませんが、公開することが出来ます。
コンポーネントやサンプルプログラムなど、公開できるものがございましたらぜひご利用下さい。
登録にはユーザー登録が必要です。
このサイト
このサイトはちいたん(奥さんの方ではありません)を利用して作られています。 ちなみに、現在のちいたんフレームワークの総容量は(非圧縮で)
42Kバイトです。MySQLのみを使用して余分なファイル(db/mysql.php, db/common.php以外)を削除すると、
31Kバイトになります。
ちいたん(PHPフレームワークの方)の特徴
・最小ソースコードはこれだけです。
お客様のサーバーにsmarty設置させるのもまどろっこしい。構文解析なんて勘弁!
| 1ファイルの場合 |
テンプレート使用の場合 |
<?php
require_once( "cheetan.php" );
function action( &$c )
{
$c->set( "msg", "Hello, World!" );
}
?>
<html>
<body>
<h1><?php print $data["msg"]; ?></h1>
</body>
</html>
|
----hello.php----
<?php
require_once( "cheetan.php" );
function action( &$c )
{
$c->set( "msg", "Hello, World!" );
}
?>
----hello.html----
<html>
<body>
<h1><?php print $data["msg"]; ?></h1>
</body>
</html>
|
・テンプレートも使えます。
全てのページで同じテンプレートを使いたい時
| 1ファイルの場合 |
テンプレート使用の場合 |
----temp.html----
<html>
<body>
<?php contents( $data ); ?>
</body>
</html>
----hello.php----
<?php
require_once( "cheetan.php" );
function action( &$c )
{
$c->SetTemplateFile( "temp.html" );
$c->set( "msg", "Hello, World!" );
}
function contents( $data )
{
?>
<h1><?php print $data["msg"] ); ?></h1>
<?php
}
?>
|
----temp.html----
<html>
<body>
<?php $this->content(); ?>
</body>
</html>
----hello.php----
<?php
require_once( "cheetan.php" );
function action( &$c )
{
$c->SetTemplateFile( "temp.html" );
$c->set( "msg", "Hello, World!" );
}
?>
----hello.html----
<h1><?php print $data["msg"]; ?></h1>
|
・モデルも完備。
データベースへの保存もこれだけ。
----config.php----
function config_database( &$db )
{
$db->add( "", "localhost", "user", "password", "db" );
}
function config_models( &$controller )
{
$controller->AddModel( "user.php" );
}
----user.php----
class CUser extends CModel
{
}
----test.php----
<?php
require_once( "config.php" );
require_once( "cheetan.php" );
function action( &$c )
{
if( count( $_POST ) )
{
$c->user->insert( $c->data["user"] );
}
}
?>
<form method="post" action="test.php">
名前<br>
<input type="text" name="user/name"><br>
メールアドレス<br>
<input type="text" name="user/email">
</form>
|
|