輕量級 PHP 框架 TinyLara 更新:更優雅 附中文介紹

TinyLara

logo

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

中文介紹

TinyLara 是一個輕量級 PHP 框架,基於 Composer,能夠當作 Laravel 的精簡版。官方網站:http://tinylara.com/php

Github

Github 項目地址:https://github.com/TinyLara/TinyLaralaravel

開始使用

下載:

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

或者:git

wget https://codeload.github.com/TinyLara/TinyLara/legacy.zip/master
unzip master
cd TinyLara*

安裝依賴包:

composer update

修改數據庫配置文件 app/database.php,將 demo.sql 導入數據庫。github

查看代碼:

config/routes.php :redis

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

更加優雅的郵件發送及視圖調用接口:

app/controllers/HomeController.php :sql

public function home()
{
  // mail sample
  Mail::to('foo@bar.io')->from('bar@foo.io')
                        ->title('Foo Bar')
                        ->content('Hello~~')
                        ->send();
  // redis sample
  Redis::set('key','value',3000,'ms');
  echo Redis::get('key');

  // view sample
  return View::make('home')->with('article',Article::first())
                            ->withTitle('TinyLara :-D')
                            ->withFooBar('foo_bar');
}

運行項目:

cd public && php -S 127.0.0.1:3000

訪問 http://127.0.0.1:3000/數據庫

TinyLara 已經跑起來了!


特性

  1. 微型路由包 TinyLara/TinyRoute, 基於性感而快速的 codingbean/macaw
  2. MVC 架構
  3. 採用地球上最強大的 PHP ORM 之一:Laravel Eloquent
  4. 優雅而強大的 Laravel 式的視圖加載器
  5. 支持原生 PHP 操做 Redis,無需安裝任何 PHP 擴展。
  6. 一行代碼便可發送 SMTP 郵件。

協議

TinyLara 採用 MIT license 協議分發,衍生項目除了必須採用 MIT 協議以外無任何限制。架構


English Version

TinyLara is a Simple PHP Framework based on Composer, looks like a Tiny Laravel.app

Start

Download:

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

OR:composer

wget https://codeload.github.com/TinyLara/TinyLara/legacy.zip/master
unzip master
cd TinyLara*

Install dependencies:

composer update

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

Just see:

config/routes.php :

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

app/controllers/HomeController.php :

public function home()
{
  // mail sample
  Mail::to('foo@bar.io')->from('bar@foo.io')
                        ->title('Foo Bar')
                        ->content('Hello~~')
                        ->send();
  // redis sample
  Redis::set('key','value',3000,'ms');
  echo Redis::get('key');

  // view sample
  return View::make('home')->with('article',Article::first())
                            ->withTitle('TinyLara :-D')
                            ->withFooBar('foo_bar');
}

Run:

cd public && php -S 127.0.0.1:3000

Visit http://127.0.0.1:3000/

It's already running!


Features

  1. Tiny router TinyLara/TinyRoute, based on fast and sexy codingbean/macaw
  2. MVC architecture
  3. One of the Most powerful PHP ORM on Earth: Laravel Eloquent
  4. Powerful Laravel-style views loader
  5. Redis ready in Laravel-style
  6. Handy SMTP mailer

License

The TinyLara framework is open-sourced software licensed under the MIT license

相關文章
相關標籤/搜索