# slimore **Repository Path**: pandao/slimore ## Basic Information - **Project Name**: slimore - **Description**: Slimore 是一个基于 Slim 框架的完全 (H)MVC 框架。 - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: https://github.com/slimore/slimore - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-06-09 - **Last Updated**: 2021-06-20 ## Categories & Tags **Categories**: webframework **Tags**: None ## README # Slimore The fully (H)MVC framework based on the [Slim PHP Framwork v2.6.x](https://github.com/slimphp/Slim) . ### Install > Require php >=5.4.0 . composer.json : ```json { "require" : { "slimore/slimore" : "*" } } ``` Install : $ composer install ### Directory structure Single module : / app/ controllers/ models/ views/ configs/ routes.php settigns.php public/ .htaccess index.php vendor/ ... composer.json Multi modules : / app/ frontend/ controllers/ models/ views/ backend/ controllers/ models/ views/ api/ controllers/ models/ views/ ... configs/ routes.php settings.php public/ .htaccess index.php vendor/ ... composer.json ### Usige .htaccess : ```htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L] ``` index.php : ```php true, 'path' => APP_PATH, 'baseURL' => BASE_URL, //'modules' => ['home', 'admin', 'api'], // Multi-Modules //'defaultModule' => 'home', 'autoloads' => [ APP_PATH . 'path/xx/xx' ] ]); //$app->dbConnection(); // if using database $app->get("/", function() { echo "Hello world!"; }); // Routes //$app->get('/news', 'NewsController:read'); // or $app->get('/news', controller('index', 'read')); //$app->get('/news', 'Home\Controllers\NewsController:read'); // or $app->get('/news', controller('news', 'read', 'Home\Controllers\\')); //$app->post('/news', 'Home\Controllers\NewsController:create'); //$app->put('/news/:id', 'Home\Controllers\NewsController:update'); //$app->delete('/news/:id', 'Home\Controllers\NewsController:delete'); // or /* $app->moduleNamespace('Home\Controllers\\', function($namespace, $app) { //echo $namespace; $ctl = 'IndexController'; //$app->get('/', $namespace . $ctl . ':index'); //$app->get('/news/:id', $namespace . $ctl . ':index'); $app->controller('index', function($controller, $app, $namespace) { //echo $controller . ', ' . $namespace; //$app->get('/news/:id', $namespace . $controller . ':index'); }, $namespace); });*/ // Auto routes => /:action, /:controller/:action, /:module/:controller/:action $app->autoRoute(); $app->run(); ``` Model : ```php Using Eloquent ORM / Model : [http://laravel.com/docs/5.0/eloquent](http://laravel.com/docs/5.0/eloquent) View : <?=$title?> Controller : ``` db->table('news') ->select(['nid', 'cid', 'title', 'content', 'add_time']) ->where(['cid' => 0]) ->orderBy('nid', 'DESC') ->get(); //print_r($news); // Basic database usage, same Laravel $results = DB::select('select * from users where id = ?', [1]); // Slim application methods // request $get = $this->request->get(); // response //$this->response->headers->set('Content-Type', 'application/json'); // view $this->view->setData(array( 'color' => 'red', 'size' => 'medium' )); // render views/index.php $this->render('index', [ 'title' => 'Hello world!' . $article->title, 'article' => $article ]); // output json /*$this->json([ 'status' => 200, 'message' => 'xxxxxx', 'data' => $article ]);*/ } } ``` > Using Slim : [http://docs.slimframework.com/](http://docs.slimframework.com/) ### Dependents - [Slim framework](https://github.com/slimphp/Slim) - [illuminate/database](https://github.com/illuminate/database) - [illuminate/events](https://github.com/illuminate/events) ### Components - Captcha - Debug\Simpler - Functions - FileCache - Http\Client - Image\Gd - Log\Writer - Pagination - Uploader - ... ### Changes [Change logs](https://github.com/slimore/slimore/blob/master/CHANGE.md) ### License The [MIT License](https://github.com/slimore/slimore/blob/master/LICENSE). Copyright (c) 2015 Pandao