Installation

Requirements

  • php_fileinfo PHP extension
  • yarn

Docker installation

  1. We use a temporary docker container to build up an Enso project. Enso currently uses Laravel 5.4

    mkdir [SITE_NAME]
    docker run --rm -i -v $(pwd):/opt -w /opt shippingdocker/php-composer:latest composer create-project --prefer-dist laravel/laravel [SITE_NAME] "5.4.*"
    cd [SITE_NAME]
    
  2. Add the Yadda repository to your projects composer.json

    "repositories": [
       {
           "type": "composer",
           "url": "https://packages.maya.agency"
       }
    ]
    
  3. Use the temporary docker container to install Enso via composer.

    docker run --rm -it -v $(pwd):/opt -v ~/.ssh:/root/.ssh -w /opt shippingdocker/php-composer:latest composer require --prefer-stable yadda/enso-core:^0.2
    
  4. Fill in details in .env.

  5. Because we're using Laravel Mix 2 we need to update package.json and remove cross-env from the from dev, watch, hot and production scripts.

Once we move to a version that comes with Mix 2 by default we will no longer have to do this.
  1. Add the necessary Service Providers and Aliases to config/app.php
n.b. order of Service Providers is important - ideally you'd have Laravel, third party then Enso specific, then app specific Services Providers.

#### Providers

```php TorMorten\Eventy\EventServiceProvider::class, Mews\Purifier\PurifierServiceProvider::class, Spatie\Analytics\AnalyticsServiceProvider::class, Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider::class,

Yadda\Enso\Utilities\EnsoUtilitiesServiceProvider::class, Yadda\Enso\EnsoServiceProvider::class, Yadda\Enso\EnsoSettingsServiceProvider::class, Yadda\Enso\EnsoUserServiceProvider::class, Yadda\Enso\EnsoMediaServiceProvider::class, Yadda\Enso\EnsoAnalyticsServiceProvider::class, ```

#### Aliases

php 'Alert' => Yadda\Enso\Utilities\Alerts\Facades\AlertsFacade::class, 'Analytics' => Spatie\Analytics\AnalyticsFacade::class, 'Enso' => Yadda\Enso\Facades\EnsoFacade::class, 'EnsoCrud' => Yadda\Enso\Facades\EnsoCrud::class, 'EnsoMedia' => Yadda\Enso\Facades\EnsoMedia::class, 'EnsoMenu' => Yadda\Enso\Facades\EnsoMenu::class, 'EnsoMeta' => Yadda\Enso\Facades\EnsoMeta::class, 'Eventy' => TorMorten\Eventy\Facades\Events::class, 'Purifier' => Mews\Purifier\Facades\Purifier::class,

  1. In config/filesystems.php change default to public;

  2. Install this workaround.

  3. Use the temporary container to publish laravel & enso vendor assets

    docker run --rm -it -v $(pwd):/opt -w /opt shippingdocker/php-composer:latest php artisan vendor:publish
    
  4. You can now remove the temporary container.

    docker image rm shippingdocker/php-composer:latest
    
  5. You may need to change the permissions on the enso script

    sudo chmod 744 enso

  6. start your docker container, and then run the enso install script

    enso start
    enso artisan enso:install
    
  7. Add some Enso starter routes to your routes/web.php file.

    Route::group(['middleware' => 'auth'], function() {
       Route::post('admin/pages/publish', 'Admin\PagePublishController@publish')->name('admin.pages.publish');
       Route::post('admin/pages/unpublish', 'Admin\PagePublishController@unpublish')->name('admin.pages.unpublish');
       EnsoCrud::routes('admin/pages', "\\" . config('enso.crud.page.controller'), 'admin.pages');
       Route::get('admin', 'Admin\DashboardController@index');
    });
    Route::get('{page}', ['as' => 'pages.show', 'uses' => 'PageController@show']);
    
  8. Add meta tags to your main template. In resources/views/layouts/app.blade.php in the <head> remove the <title> element and replace it with:

    @include('enso-meta::display')
    
  9. Install npm dependencies

    enso yarn add --dev \
       axios \
       babel-preset-es2015 \
       buble \
       bulma \
       eslint \
       eslint-config-airbnb \
       eslint-config-prettier \
       eslint-plugin-prettier \
       gulp \
       imagemin-svgo@^4.2.0 \
       imagemin-webpack-plugin \
       laravel-mix@^2.0 \
       lodash \
       vue-axios \
       vue-multiselect@next \
       vue-slider-component \
       vuejs-datepicker \
       vue2-leaflet@~0.0.60 \
       moment \
       moment-timezone \
       portal-vue \
       prettier \
       quill \
       quill-render \
       resumablejs \
       stylelint-config-airbnb \
       [email protected] \
       vuedraggable \
       [email protected] \
       vuex \
       webpack-svgstore-plugin
    
  10. Run enso yarn install

  11. Remove any unwanted content from resources/assets/js/app.js and resources/assets/js/bootstrap.js

  12. Run enso yarn run dev

  13. Your site should now function.

Optional installation

  1. Add Google Analytics code to views. See Google Analytics

  2. For image optimization, you will need to install the appropriate libraries

  3. Ensure you restrict CMS access

  4. Check that your development environment is set up for the code quality tools

  5. Set up your project for testing

Development

If you're developing enso-core you can use the following to load your packages from a local directory.

```php
"repositories": [
    {
        "type": "path",
        "url": "../packages/yadda/*"
    }
]
```