定制 icebox-php/icebox 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

icebox-php/icebox

最新稳定版本:v0.1.2

Composer 安装命令:

composer create-project icebox-php/icebox

包简介

The skeleton application for the Icebox Framework.

README 文档

README

composer create-project icebox-php/icebox my-app
cd my-app

How to run this web-app

cd my-app
composer install
php icebox server
It will run the application to this url http://localhost:8800

If you want to run in different host and port
php icebox server --host=0.0.0.0 --port=8802
It will run the application to this url http://0.0.0.0:8802

Home: http://localhost/my-app/index.php

Page 2: http://localhost/my-app/index.php/leap_year/2012
or : http://localhost/my-app/leap_year/2012

Example urls to test params

http://localhost/my-app/about/marketing/item/5/title/some-text

404 error page

http://localhost/my-app/an-invalid-url

How to run testsuite

vendor/bin/phpunit ./Test/

How to upload image

  1. create a string column, Such as, I added "picture" column, datatype: varchar, length: 255

  2. Add this code to _form:

  <div class="form-group">
    <label for="post_picture">Picture</label>
    <input id="post_picture" type="file" name="picture">
  </div>
  1. In controller, after you save model, a. upload file and b. set file name in model and c. save the model again with validate false.
    Add this code to controller (I added this code in "create" action):
if($saved) {

    if(isset($_FILES['picture'])) {
      $pictue_file_name = md5(microtime()) . '.jpg';
      $path = 'public/images/' . $pictue_file_name;
      move_uploaded_file($_FILES['picture']['tmp_name'], $path);
      $post->picture = $pictue_file_name;
      $post->save(false);
    }

    ....
    ....
} else {
    ....
    ....
}
  1. now you can show this image in "View/Posts/show.html.php" view:
  <img src="<?php echo App::root_url(); ?>/images/<?php echo $post->picture; ?>" alt="">

Configuration

You can dynamically configure your application using App::configure() and retrieve values with App::config().

// Usage
Config::set([
    'log_level' => 'info',
    'time_zone' => 'UTC',
    'nested' => [
        'option' => 'some-value',
    ]
]);

// Later, override specific values
Config::set([
    'log_level' => 'debug', // This overrides the previous value
]);

echo Config::get('log_level'); // 'debug'
echo Config::get('time_zone'); // 'UTC'
echo Config::get('nested.option'); // 'some-value'

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-11