Download the PHP package ljw/framework without Composer

On this page you can find all versions of the php package ljw/framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package framework

A simple framework for FMZ!

简介

安装

方法一

目录结构

ljw                     WEB部署目录(或者子目录)
├─app                   应用目录
│  ├─controllers        控制器
│  ├─models             模型
│  └─views              视图  
├─bootstrap             
│  └─bootstrap.php      应用启动文件
├─config                配置文件目录
│  ├─app.php            项目配置
│  ├─routes.php         路由配置文件
│  ├─redis.php          redis配置
│  └─database.php       数据库配置文件 
├─lib                   框架系统目录
│  ├─http               http目录
│  ├─session            session存放实现目录
│  ├─view               视图目录
│  └─ ...               更多系统模块
│
├─public                WEB目录(对外访问目录)
│  ├─static             静态文件目录,比如js,image
│  ├─index.php          入口文件
│  └─.htaccess          用于apache的重写
├─runtime
│  ├─cache              缓存文件目录
│  ├─log                日志文件目录
│  └─smarty             smarty使用的目录
|
├─vendor                第三方类库目录(Composer依赖库)
├─.env                  环境配置文件,请自行创建或复制.env.example
├─.env.example          环境配置文件示例,请复制修改为.env
├─composer.json         composer 定义文件
└─README.md             README 文件

配置简介

env($name, $default = null)方法会读取文件 .env 中的配置项。

每个环境可能不同,顾没有加入到git版本控制中,请自行添加,或者复制 .env.example 文件为 .env

1. app.php

return [
    //session存放 为空表示用自带的, '' || mysql_pdo || redis , 具体看lib/session中的文件
    'session'           => '',
    'session_table'     => 'session',    //session 存放在mysql中的表名
    'session_lefttime'  => 1000,         //session有效时间
    'session_redis_dir' => 'default',            //session 使用的redis配置
    'debug'             => env('APP_DEBUG', false),         //调试模式
    'view'              => 'smarty',     //模板 smarty||native
    'smarty'            => [             //smarty配置
        'debug'           => env('SMARTY_DEBUG', false),            //是否弹出debug窗口
        'force_compile'   => env('SMARTY_FORCE_COMPILE', false),    //检查模板是否改动,开发时打开,正式 关闭
        'cache'           => env('SMARTY_CACHE', true),             //是否缓存
        'cache_lifetime'  => 1200,       //缓存时间
        'cache_dir'       => RUNTIME_PATH . 'smarty/cache/',          //缓存目录
        'compile_dir'     => RUNTIME_PATH . 'smarty/templates_c/',    //编译目录
        'left_delimiter'  => '<{',      //左定界符
        'right_delimiter' => '}>'       //右定界符
    ],
    'cache'             => 'file',       //缓存类型,file||redis
    'cache_expire'      => 1200,         //缓存时间
    'cache_file_dir'    => RUNTIME_PATH . 'cache/',
    'cache_redis_dir'   => 'default',   //cache 使用的redis配置
    'sys_log'           => env('SYS_LOG', true),                 //系统日志是否开启
    'sys_log_level'     => env('SYS_LOG_LEVEL', 'debug'),        //系统日志级别
    'sys_error_log'     => env('SYS_ERROR_LOG', true)            //系统错误日志是否开启

];
debug 是否打开DEBUG模式

1) SESSION的相关配置

session session存储方式
session_table 用mysql存储session时的表名
session_redis_dir 用redis存储session时的配置
session_lefttime session的过期时间,单位秒

2) 视图配置

视图模板都用.tpl作为文件后缀

view 视图

3) 缓存配置

cache 缓存使用方式
cache_expire 缓存有效时间
cache_file_dir 缓存文件目录
session_redis_dir 缓存使用的redis 配置

2. routes.php

路由配置 参考ljw/route

use \Ljw\Route\Route;
Route::space('app\\controllers\\', 'app\\middleware\\');

Route::get('', 'IndexController@index');
Route::get('index/middle','Index@index', 'IndexController@middle');

Route::error(function (){
    app('response')->status('404');
    echo '404 Not Found!';
});
Route::run();

get get请求

post post请求

error 错误

3. redis.php

redis相关配置

return [
    'default' => [
        'host'     => env('REDIS_HOST', '127.0.0.1'),
        'pwd'      => env('REDIS_PASSWORD', null),
        'port'     => env('REDIS_PORT', 6379),
        'database' => 0,
    ]
];

4. database.php

数据库相关配置

return [
    'driver'      => 'mysql',
    'host'        => env('DB_HOST', '127.0.0.1'),
    'port'        => env('DB_PORT', '3306'),
    'database'    => env('DB_DATABASE', 'forge'),
    'username'    => env('DB_USERNAME', 'forge'),
    'password'    => env('DB_PASSWORD', ''),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset'     => 'utf8mb4',
    'collation'   => 'utf8mb4_unicode_ci',
    'prefix'      => '',
    'strict'      => true,
    'engine'      => null,
];

添加命令行模式

php console demo/first[/param1[/param2[...]]]

All versions of framework with dependencies

PHP Build Version
Package Version
Requires filp/whoops Version 2.1.4
monolog/monolog Version 1.21.0
illuminate/database Version *
smarty/smarty Version *
ljw/excel Version dev-master
ljw/route Version dev-master
vlucas/phpdotenv Version v2.4.0
guzzlehttp/guzzle Version ~6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ljw/framework contains the following files

Loading the files please wait ....