輕量級 PHP 框架:TinyLara

jopen 10年前發布 | 28K 次閱讀 TinyLara PHP開發

TinyLara 是一個輕量級 PHP 框架,基于強大的 Composer。

  ______    _                      __                         
 /_  __/   (_)   ____    __  __   / /   ____ _   _____  ____ _
  / /     / /   / __ \  / / / /  / /   / __ `/  / ___/ / __ `/
 / /     / /   / / / / / /_/ /  / /___/ /_/ /  / /    / /_/ / 
/_/     /_/   /_/ /_/  \__, /  /_____/\__,_/  /_/     \__,_/  
                      /____/

主要特性如下:

1. 采用 150 行代碼完成的路由包 codingbean/macaw

2. MVC 架構

3. 采用地球上最強大的 PHP ORM 之一:Laravel Eloquent

4. 優雅而強大的 Laravel 式視圖加載器

5. 支持原生 PHP 操作 Redis,無需安裝任何 PHP 擴展。

6. 一行代碼即可發送 SMTP 郵件。

Download:

git clone https://github.com/TinyLara/TinyLara
cd TinyLara

Install dependencies:

composer update

Then modify `app/database.php` with right information and import `demo.sql`.

See:

config/routes.php :

Macaw::get('', 'HomeController@home');

app/controllers/HomeController.php :

public function home()
{
  // build view sample
  $this->view = View::make('home')->with('article',Article::first())
                                  ->withTitle('TinyLara :-D')
                                  ->withFooBar('foo_bar');


  // build mail sample
  $this->mail = Mail::to('foo@bar.io')->from('bar@foo.io')
                                      ->title('Foo Bar')
                                      ->content('<h1>Hello~~</h1>');
  // redis sample
  Redis::set('key','value',3000,'ms');
  echo Redis::get('key');
}

Run:

cd public && php -S 127.0.0.1:3000

Visit http://127.0.0.1:3000/


項目主頁:http://www.baiduhome.net/lib/view/home/1414478438653

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!