phalcon-ext/widgets 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

phalcon-ext/widgets

Composer 安装命令:

composer require phalcon-ext/widgets

包简介

Widgets component for Phalcon.

README 文档

README

Installing

Install composer in a common location or in your project:

curl -s http://getcomposer.org/installer | php

Create the composer.json file as follows:

{
	"require": {
		"phalcon-ext/widgets": "dev-master"
	}
}

Run the composer installer:

php composer.phar install

Add in your the code

require_once('vendor/autoload.php');

Using

class SomeWidget extends Phalcon\Ext\Widgets\WidgetBase
{
  public function init()
  {
    // optional some method
  }
  
  public function render($params = null) 
  {
    return $params['a'] + $params['b'] * ($params['c'] ?: 1);
  }
}

// Register widgets manager in DI
$di->setShared('widgets', function() use ($di) {

  $widgets = new Phalcon\Ext\Widgets\Manager();
  
  // Register some widget (the syntax is similar in DI)
  $widgets->set('some', function($options) {
    $widget = SomeWidget($options);
    $widget->init();
    
    return $widget;
  });
  
  return $widgets;
});


/**
 * Somewhere in view
 */

$options = []; // Optional parameter, It will be passed to the constructor of the widget before creating

echo $this->getDI()->get('widgets')->render('some', ['a' => 5, 'b' => 5, 'c' => 2], $options); // 15

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL
  • 更新时间: 2014-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固