PHP code example of leandrogehlen / yii2-codemirror

1. Go to this page and download the library: Download leandrogehlen/yii2-codemirror library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leandrogehlen / yii2-codemirror example snippets



 

use leandrogehlen\codemirror\CodeMirror;

<?= $form->field($file, 'description')->widget(CodeMirror::className(), [
    'pluginOptions' => [
        'mode' => 'application/x-httpd-php', 
        'theme' => 'solarized dark',
        ...
    ]
]);


  
  //config/web.php
  
  $config = [
      'id' => 'my-app',
      'components' => [
        ...
      ]
      ...
  ]
  
  Yii::$container->set('leandrogehlen\codemirror\CodeMirrorAsset',[
      'js' => [
          'mode/htmlmixed/htmlmixed.js',
          'mode/xml/xml.js',
          'mode/javascript/javascript.js',
          'mode/clike/clike.js',
          'mode/php/php.js',
      ]
  ]);
  
  
  return $config;
  

php composer.phar