eric404/droplet

PHP/DropLet/PHP 框架

V1.1 2018-01-17 06:05 UTC

This package is not auto-updated.

Last update: 2024-09-22 06:07:03 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

DropLara 是一个由 Composer 驱动的简单 PHP 框架,看起来像一个小型 Laravel。

开始

下载

git clone https://github.com/EricLi404/DropLet.git
cd DropLet

或者

发布页面下载。

安装依赖

composer update

数据库导入

  • 导入DropLara.sql;
  • config/database_demo.php重命名为config/database.php ;
  • 修改config/database.php

运行

cd public 
php -S 127.0.0.1:2333

然后访问http://127.0.0.1:2333

成功了!

URL 重写

Apache

# .htaccess
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Nginx

# nginx.conf
autoindex off;

location / {
	try_files $uri $uri/ /index.php?/$uri;
}

插件

邮件

修改config/mail.php

return [
    'host'=>'smtp.xxxx.com',
    'username'=>'xxx@xxxx.com',
    'password'=>'password'
];

修改app/controllers/xxxxController.php

$this->mail = Mail::to('test@gmail.com')
            ->subject('Hello World')
            ->htmlBody('<h1>Hello World from DropLet</h1>');
            

Redis

修改config/redis.php

return [
    'host' => '127.0.0.1',
    'port' => 6379
];

修改app/controllers/xxxxController.php

Redis::set('key','value',3000,'ms');
echo Redis::get('key');

特性

  1. MVC 架构
  2. 类似 Laravel 的 Redis 就绪
  3. 方便的 SMTP 邮件发送器
  4. 地球上最强大的 PHP ORM 之一:Laravel Eloquent
  5. 由快速而性感的codingbean/macaw支持的 RouteModule

许可

DropLara 框架是开源软件,使用MIT 许可证