coreplex/core 问题修复 & 功能扩展

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

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

coreplex/core

最新稳定版本:v0.1.3

Composer 安装命令:

composer require coreplex/core

包简介

A collection of core classes for the coreplex packages.

README 文档

README

A collection of core classes for the coreplex packages.

Installation

This package requires PHP 5.4+, and includes a Laravel 5 Service Provider.

We recommend installing the package through composer. You can either call composer require coreplex/core in your command line, or add the following to your composer.json and then run either composer install or composer update to download the package.

"coreplex/core": "~0.1"

Laravel 5 Integration

To use the package with Laravel 5 firstly add the core service provider to the list of service providers in app/config/app.php.

'providers' => array(

  Coreplex\Core\CoreServiceProvider::class,

);

The publish the config file by running php artisan vendor:publish.

Using the Renderer

To get started with the renderer, firstly you need to initialise the class.

$renderer = new Coreplex\Core\Renderer\Renderer(); 

To access the renderer from laravel just access it via the IOC container by its contract or its alias.

public function __construct(Coreplex\Core\Contracts\Renderer $renderer)
{
    $this->renderer = $renderer;
}

$renderer = app('coreplex.core.renderer');

Rendering Templates

To render a view to a string call the make method on the renderer. You can also pass dynamic data to the view by passing an array of key value pairs as a second parameter.

$view = $renderer->make('path/to/view.php');
$view = $renderer->make('path/to/view.php', ['foo' => 'bar']);

Using the Session

To get started with the session class with firstly need to initialise it.

$config = require('path/to/coreplex.php');

$session = new Coreplex\Core\Session\Native($config);

Or with laravel just resolve it from the IOC container.

public function __construct(Coreplex\Core\Contracts\Session $session)
{
    $this->session = $session;
}

$session = app('coreplex.core.session');

Add Item

To add an item to the session use the put method.

$session->put('foo', 'bar');

Or to flash an value for the next request use the flash method.

$session->flash('foo', 'bar');

Getting Items

To get an item from the session use the get method.

$session->get('foo');

You may also want to check if an item exists in the session; to do so use the has method.

$session->has('foo');

Removing Items

To remove an item from the session use the forget method.

$session->forget('foo');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-20