GithubHelp home page GithubHelp logo

yaf-library's Introduction

依赖

  • PHP
  • Yaf 扩展
  • Composer

组件

yaf框架本身是一个比较精简的MVC框架, 本身并没有提供其他类库, 本项目主要提供了一些常用到的组件:

  • 验证码 Captcha
  • 数据库 ORM
  • Http
  • Cache
    • Redis
    • Memcached
  • 日志
  • 上传组件
  • 校验
  • 视图
  • 事件
  • 依赖注入

安装

安装类库

方式一(用于单项目):

composer require phpcasts/yaf-library -vvv

方式二(用于多项目共享):

git clone https://github.com/qloog/yaf-library

修改配置文件的: application.library = APP_PATH "/library" 为: application.library = APP_ROOT "/../yaf-library"

PS: yaf-library与项目在同一级目录, 达到多项目共享一套 yaf-library 的目的,便于维护和管理

添加配置

打开 conf/application.ini, 添加一下配置:

; cache
cache.type = redis
cache.redis = default

; Redis
redis.default.host = 127.0.0.1
redis.default.port = 6379

;database
database.driver     = mysql
database.host       = localhost
database.database   = test
database.username   = root
database.password   = 123456
database.port       = 3306
database.charset    = utf8
database.collation  = utf8_unicode_ci
database.prefix     = ""

; Log
log.level = debug
log.channel = default
log.file.dir = APP_ROOT "/storage/logs"

添加常量定义

一般定义在public/index.php文件中

define('APP_ROOT', dirname(__DIR__));
define('APP_PATH', APP_ROOT . '/application');

Usage

以使用Cache为例:

use PHPCasts\Yaf\Caches\Cache;
...
 
 $cache = Cache::getInstance();
 $cache->set('test', 'test-value');

实际使用

Docs

License

MIT

yaf-library's People

Contributors

qloog avatar

Watchers

James Cloos avatar

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.