Git Product home page Git Product logo

tinylara's Introduction

TinyLara Travis

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

TinyLara is a Simple PHP Framework based on Composer, looks like a Tiny Laravel. Read the documentation. TinyLara supports PHP7 now!

Start

Download:

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

OR:

wget https://github.com/TinyLara/TinyLara/archive/v1.5.zip
unzip v1.5.zip
cd TinyLara-1.5

Install dependencies:

composer update

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

Just see:

config/routes.php :

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

Route::any('foo', function() {
  echo "Foo!";
});

app/controllers/HomeController.php :

public function home()
{
  // mail sample
  Mail::to('[email protected]')->from('[email protected]')
                        ->title('Foo Bar')
                        ->content('<h1>Hello~~</h1>')
                        ->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/TinyRouter, 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 view loader TinyLara/TinyView
  5. Redis ready in Laravel-style
  6. Handy SMTP mailer

License

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

tinylara's People

Contributors

johnlui avatar llawliet444 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinylara's Issues

wrong way to call func

execute "composer update", and i get vendor/tinylara,
i find some code in line 29 in ./framework/src/TinyLara/Validation/Validator.php like this "$reason = $this->$detail[0]($this->data[$attribute], $detail[1]);".
when i run this framework i get some wrong message,
i use call_user_func_array() instead like "$reason = call_user_func_array([$this, $detail[0]], [$this->data[$attribute], $detail[1]]);" to avoid wrong message. my php version is 7.0.1

经测试,该套代码非常占用资源

用tinylara实现我原来api接口同样的功能,但是上到服务器后,cpu占有率比我原来代码多消耗2-3倍。
刚开始以为是路由的问题,换了原生的macaw,占用依旧。然后换了其他路由,同样占用未降。
之后,又做了测试,使用tinylara移植我我原来的api的controller进来,测试占用也同样高。
日志、错误显示什么的,都有关闭,甚至Illuminate的数据库查询日志也关闭了。但是问题依旧。不得找到原因。
请作者分析看看,究竟是什么原因导致对服务器资源占用超过如此之多。服务器环境是高并发,在普通环境下无法看到性能问题。

如何请求和接收参数呢

请问如何通过路由请求参数和在控制器中接收参数呢, 我尝试用laravel的方法,发现get方法找不到路由,post方法得不到参数.

Failed opening required autoload.php

I clone the project, cd into public, run 'php -S 127.0.0.1:3000', go to localhost:3000,
and I get this error

[Sat Nov  1 09:28:10 2014] 127.0.0.1:63174 [500]: / 
- require(): Failed opening required 
'[path to TinyLara]/TinyLara/vendor/autoload.php' (include_path='.:') 
in [path to TinyLara]/TinyLara/bootstrap.php on line 15

关于模型命名空间

Article.php范例的首部要加上命名空间,给出正确调用的例子:
namespace App\Model;
/**

  • Article Model
    */
    class Article extends \Illuminate\Database\Eloquent\Model {
    public $timestamps = false;
    }
    这样在控制器就可以开心的使用模型了
    use App\Model\Article;

日志和数据库的加载配置文件的设计问题

日志和数据库的加载配置文件,放在framework框架中。要改配置文件名或者路径,还需要到framework中去改LoadConfiguration.php,这种设计个人感觉不是很合理。
最好是调用framework之后,可以自己配置的,就像早期的版本。
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.