Yii2 via composer and highcharts extension on mint

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
$ composer global require "fxp/composer-asset-plugin:^1.2.0"
Changed current directory to /home/adull/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing fxp/composer-asset-plugin (v1.3.0): Loading from cache
Writing lock file
Generating autoload files
$ composer install
Composer could not find a composer.json file in /home/adull/Documents/html/yii/composer
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
$ composer create-project --prefer-dist yiisoft/yii2-app-basic basic
Installing yiisoft/yii2-app-basic (2.0.11)
  - Installing yiisoft/yii2-app-basic (2.0.11): Loading from cache
Created project in basic
Loading composer repositories with package information
Updating dependencies (including require-dev)
Reading bower.json of bower-asset/punycode (v1.3.0)       
Could not fetch https://api.github.com/repos/bestiejs/punycode.js/contents/bower.json?ref=40e15ef43a44fdcb2b60fb631384168ef8e0181f, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+nano+2017-03-31+1343
to retrieve a token. It will be stored in "/home/adull/.composer/auth.json" for future use by Composer.
Token (hidden): 

https://github.com/settings/tokens

screencapture-github-settings-tokens-new-1490945930695

token

Token stored successfully.
Reading bower.json of bower-asset/jquery.inputmask (3.1.56)
Reading bower.json of bower-asset/jquery.inputmask (3.1.55)

Reading bower.json of bower-asset/jquery.inputmask (3.1.53)
Reading bower.json of bower-asset/jquery (1.7.2)           
Package operations: 59 installs, 0 updates, 0 removals  
  - Installing yiisoft/yii2-composer (2.0.5): Downloading (100%)         
  - Installing swiftmailer/swiftmailer (v5.4.6): Downloading (100%)         
  - Installing bower-asset/jquery (2.2.4): Downloading (100%)         
  - Installing bower-asset/yii2-pjax (v2.0.5): Downloading (100%)         
  - Installing bower-asset/punycode (v1.3.2): Downloading (100%)         
  - Installing cebe/markdown (1.1.1): Downloading (100%)         
  - Installing ezyang/htmlpurifier (v4.9.2): Downloading (100%)         
  - Installing bower-asset/jquery.inputmask (3.3.4): Downloading (100%)         
  - Installing yiisoft/yii2 (2.0.11.2): Downloading (100%)         
  - Installing yiisoft/yii2-swiftmailer (2.0.6): Downloading (100%)         
  - Installing bower-asset/bootstrap (v3.3.7): Downloading (100%)         
  - Installing yiisoft/yii2-bootstrap (2.0.6): Downloading (100%)         
  - Installing yiisoft/yii2-debug (2.0.9): Downloading (100%)         
  - Installing bower-asset/typeahead.js (v0.11.1): Downloading (100%)         
  - Installing phpspec/php-diff (v1.1.0): Downloading (100%)         
  - Installing yiisoft/yii2-gii (2.0.5): Downloading (100%)         
  - Installing fzaninotto/faker (v1.6.0): Downloading (100%)         
  - Installing yiisoft/yii2-faker (2.0.3): Downloading (100%)         
  - Installing psr/log (1.0.2): Downloading (100%)         
  - Installing symfony/debug (v3.2.6): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.3.0): Downloading (100%)         
  - Installing symfony/console (v3.2.6): Downloading (100%)         
  - Installing stecman/symfony-console-completion (0.7.0): Downloading (100%)         
  - Installing sebastian/diff (1.4.1): Downloading (100%)         
  - Installing sebastian/recursion-context (2.0.0): Downloading (100%)         
  - Installing sebastian/exporter (2.0.0): Downloading (100%)         
  - Installing sebastian/comparator (1.2.4): Downloading (100%)         
  - Installing behat/gherkin (v4.4.5): Downloading (100%)         
  - Installing symfony/dom-crawler (v3.2.6): Downloading (100%)         
  - Installing symfony/css-selector (v3.2.6): Downloading (100%)         
  - Installing symfony/browser-kit (v3.2.6): Downloading (100%)         
  - Installing symfony/yaml (v3.2.6): Downloading (100%)         
  - Installing symfony/event-dispatcher (v3.2.6): Downloading (100%)         
  - Installing symfony/finder (v3.2.6): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)         
  - Installing sebastian/version (2.0.1): Downloading (100%)         
  - Installing sebastian/environment (2.0.0): Downloading (100%)         
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)         
  - Installing phpunit/php-token-stream (1.4.11): Downloading (100%)         
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
  - Installing phpunit/php-file-iterator (1.4.2): Downloading (100%)         
  - Installing phpunit/php-code-coverage (4.0.7): Downloading (100%)         
  - Installing sebastian/resource-operations (1.0.0): Downloading (100%)         
  - Installing sebastian/object-enumerator (2.0.1): Downloading (100%)         
  - Installing sebastian/global-state (1.1.1): Downloading (100%)         
  - Installing doctrine/instantiator (1.0.5): Downloading (100%)         
  - Installing phpunit/phpunit-mock-objects (3.4.3): Downloading (100%)         
  - Installing phpunit/php-timer (1.0.9): Downloading (100%)         
  - Installing webmozart/assert (1.2.0): Downloading (100%)         
  - Installing phpdocumentor/reflection-common (1.0): Downloading (100%)         
  - Installing phpdocumentor/type-resolver (0.2.1): Downloading (100%)         
  - Installing phpdocumentor/reflection-docblock (3.1.1): Downloading (100%)         
  - Installing phpspec/prophecy (v1.7.0): Downloading (100%)         
  - Installing myclabs/deep-copy (1.6.0): Downloading (100%)         
  - Installing phpunit/phpunit (5.7.17): Downloading (100%)         
  - Installing codeception/base (2.2.10): Downloading (100%)         
  - Installing codeception/verify (0.3.3): Downloading (100%)         
  - Installing codeception/specify (0.4.6): Downloading (100%)         
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod('runtime', 0777)...done.
chmod('web/assets', 0777)...done.
chmod('yii', 0755)...done.
$ cd basic
$ ./yii serve -p=8888

Screenshot at 2017-03-31 14-31-18

Install yii2-highcharts Extensions

$ cd basic
$ composer require --prefer-dist miloschuman/yii2-highcharts-widget "dev-master"
./composer.json has been updated
The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" option
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals                                                    
  - Installing bower-asset/highcharts (v5.0.10): Downloading (100%)         
  - Installing miloschuman/yii2-highcharts-widget (dev-master ba5e5c4): Downloading (100%)         
Writing lock file
Generating autoload files

https://github.com/miloschuman/yii2-highcharts

$ nano basic/assets/HighchartsAsset.php

<?php
namespace app\assets;

use yii\web\AssetBundle;

class HighchartsAsset extends AssetBundle
{
 public $sourcePath = '@bower/highcharts';
 public $css = [];
 public $js = [
 'highcharts.js',
 'highcharts-more.js',
 ];
 
 public $depends = [
 'yii\web\JqueryAsset'
 ];
}
?>
$ nano basic/controllers/HighchartsController.php

<?php
namespace app\controllers;

use yii\web\Controller;

class HighchartsController extends Controller
{
 public function actionIndex()
 {
 return $this->render('index');
 }
}
?>
$ nano basic/views/highcharts/index.php

<?php
use app\assets\HighchartsAsset;

HighchartsAsset::register($this);
$this->title = 'Highcharts Test';
?>

<?php $this->registerJs(" $(function () { $('#my-chart').highcharts({ title: { text: 'Monthly Average Temperature', x: -20 //center }, subtitle: { text: 'Source: WorldClimate.com', x: -20 }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (°C)' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { valueSuffix: '°C' }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0 }, series: [{ name: 'Tokyo', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }, { name: 'New York', data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5] }, { name: 'Berlin', data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0] }, { name: 'London', data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] }] }); }); ") ?>
 Screenshot at 2017-04-07 15-14-23

http://localhost/yii/composer/basic/web/index.php?r=highcharts

Screenshot at 2017-04-07 15-08-20

Advertisements

About NanoSoftTech

NanoSoftTech
This entry was posted in Framework, Linux Mint. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s