Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Drupal VM, Meet Symfony Console

Drupal VM, Meet Symfony Console

Oliver Davies

July 24, 2016
Tweet

More Decks by Oliver Davies

Other Decks in Technology

Transcript

  1. Drupal VM, Meet Symfony
    Console

    View Slide

  2. Oliver Davies (opdavies)
    Senior Drupal Developer for
    Appnovation
    Symfony hobbyist
    Drupal VM user, Drupal VM Generator
    maintainer
    Drupal Bristol organiser, PHPSW co-
    organiser, DrupalCamp committee
    member

    View Slide

  3. Prerequisites
    Object-orientated PHP
    Composer
    Autoloading, PSR-4

    View Slide

  4. About Drupal VM
    Virtual machine for Drupal development
    Developed and maintained by Jeff Geerling
    Vagrant, Ansible
    Con gured via YAML les
    Customisable

    View Slide

  5. Using Drupal VM (< 3.0)
    Download the project
    Copy example.con g.yml to con g.yml
    Edit values
    Start the VM

    View Slide

  6. Using Drupal VM (>= 3.0)
    Download the project
    default.con g.yml contains default values
    Make con g.yml if needed and override values
    Start the VM

    View Slide

  7. About the Drupal VM Generator
    Symfony application
    Twig
    Generates minimal, use-case speci c
    con guration les
    http://bit.ly/announcing-drupal-vm-generator

    View Slide

  8. Using Drupal VM (>= 3.0)
    Download the project
    default.con g.yml contains default values
    Make con g.yml if needed and override values
    Start the VM

    View Slide

  9. Drupal VM Generator Example 1

    View Slide

  10. Drupal VM Generator Example 2
    d
    r
    u
    p
    a
    l
    v
    m c
    o
    n
    f
    i
    g
    :
    g
    e
    n
    e
    r
    a
    t
    e \
    -
    -
    m
    a
    c
    h
    i
    n
    e
    -
    n
    a
    m
    e
    =
    "
    d
    r
    u
    p
    a
    l
    b
    r
    i
    s
    t
    o
    l
    " \
    -
    -
    h
    o
    s
    t
    n
    a
    m
    e
    =
    "
    d
    r
    u
    p
    a
    l
    b
    r
    i
    s
    t
    o
    l
    .
    l
    " \
    -
    -
    i
    p
    -
    a
    d
    d
    r
    e
    s
    s
    =
    "
    1
    9
    2
    .
    1
    6
    8
    .
    8
    8
    .
    8
    8
    " \
    -
    -
    c
    p
    u
    s
    =
    "
    1
    " -
    -
    m
    e
    m
    o
    r
    y
    =
    "
    5
    1
    2
    " \
    -
    -
    w
    e
    b
    s
    e
    r
    v
    e
    r
    =
    "
    n
    g
    i
    n
    x
    " -
    -
    d
    r
    u
    p
    a
    l
    -
    v
    e
    r
    s
    i
    o
    n
    =
    "
    8
    " \
    -
    -
    d
    a
    t
    a
    b
    a
    s
    e
    -
    n
    a
    m
    e
    =
    "
    d
    r
    u
    p
    a
    l
    " -
    -
    d
    a
    t
    a
    b
    a
    s
    e
    -
    u
    s
    e
    r
    =
    "
    d
    r
    u
    p
    a
    l
    " \
    -
    -
    d
    a
    t
    a
    b
    a
    s
    e
    -
    p
    a
    s
    s
    w
    o
    r
    d
    =
    "
    d
    r
    u
    p
    a
    l
    " -
    -
    b
    u
    i
    l
    d
    -
    m
    a
    k
    e
    f
    i
    l
    e
    =
    f
    a
    l
    s
    e \
    .
    .
    .

    View Slide

  11. CLI Examples
    Drush
    Symfony/Drupal Console
    Terminus (Pantheon)/Platform.sh
    Artisan (Laravel)
    Composer
    Sculpin

    View Slide

  12. CLI Examples
    Drush
    Symfony/Drupal Console
    Terminus (Pantheon)/Platform.sh
    Artisan (Laravel)
    Composer
    Sculpin

    View Slide

  13. Symfony Console

    View Slide

  14. The Console component eases the creation of
    beautiful and testable command line interfaces.
    The Console component allows you to create command-line
    commands. Your console commands can be used for any
    recurring task, such as cronjobs, imports, or other batch jobs.
    http://symfony.com/doc/current/components/console/introduction.html

    View Slide

  15. Installation
    $ c
    o
    m
    p
    o
    s
    e
    r r
    e
    q
    u
    i
    r
    e s
    y
    m
    f
    o
    n
    y
    /
    c
    o
    n
    s
    o
    l
    e
    $ c
    o
    m
    p
    o
    s
    e
    r i
    n
    s
    t
    a
    l
    l

    View Slide

  16. Installation (cont)
    # c
    o
    m
    p
    o
    s
    e
    r
    .
    j
    s
    o
    n
    "
    r
    e
    q
    u
    i
    r
    e
    "
    : {
    "
    s
    y
    m
    f
    o
    n
    y
    /
    c
    o
    n
    s
    o
    l
    e
    "
    : "
    ^
    3
    .
    1
    "
    }

    View Slide

  17. Installation (cont)
    # a
    p
    p
    .
    p
    h
    p
    r
    e
    q
    u
    i
    r
    e _
    _
    D
    I
    R
    _
    _ . '
    /
    v
    e
    n
    d
    o
    r
    /
    a
    u
    t
    o
    l
    o
    a
    d
    .
    p
    h
    p
    '
    ;
    /
    / D
    o s
    t
    u
    f
    f
    .

    View Slide

  18. Building a Console Application

    View Slide

  19. Steps
    Download the Console component
    Add an "entry point"
    Con gure and run an A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    class
    Add new Commands

    View Slide

  20. bin/drupalcamp
    #
    !
    /
    u
    s
    r
    /
    b
    i
    n
    /
    e
    n
    v p
    h
    p
    r
    e
    q
    u
    i
    r
    e _
    _
    D
    I
    R
    _
    _ . '
    /
    d
    r
    u
    p
    a
    l
    c
    a
    m
    p
    .
    p
    h
    p
    '
    ;

    View Slide

  21. bin/drupalcamp.php
    r
    e
    q
    u
    i
    r
    e _
    _
    D
    I
    R
    _
    _ . '
    /
    .
    .
    /
    v
    e
    n
    d
    o
    r
    /
    a
    u
    t
    o
    l
    o
    a
    d
    .
    p
    h
    p
    '
    ;
    u
    s
    e S
    y
    m
    f
    o
    n
    y
    \
    C
    o
    m
    p
    o
    n
    e
    n
    t
    \
    C
    o
    n
    s
    o
    l
    e
    \
    A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n = n
    e
    w A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    (
    )
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    -
    >
    r
    u
    n
    (
    )
    ;

    View Slide

  22. View Slide

  23. bin/drupalcamp.php (cont)
    r
    e
    q
    u
    i
    r
    e _
    _
    D
    I
    R
    _
    _ . '
    /
    .
    .
    /
    v
    e
    n
    d
    o
    r
    /
    a
    u
    t
    o
    l
    o
    a
    d
    .
    p
    h
    p
    '
    ;
    u
    s
    e S
    y
    m
    f
    o
    n
    y
    \
    C
    o
    m
    p
    o
    n
    e
    n
    t
    \
    C
    o
    n
    s
    o
    l
    e
    \
    A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n = n
    e
    w A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    (
    )
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    -
    >
    r
    u
    n
    (
    '
    D
    r
    u
    p
    a
    l
    C
    a
    m
    p
    s
    '
    , '
    1
    .
    0
    '
    )
    ;

    View Slide

  24. View Slide

  25. Adding Commands

    View Slide

  26. Adding Commands
    Add command classes in s
    r
    c
    /
    Autoload via Composer
    Add to A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n

    View Slide

  27. Autoloading via Composer
    # c
    o
    m
    p
    o
    s
    e
    r
    .
    j
    s
    o
    n
    "
    a
    u
    t
    o
    l
    o
    a
    d
    "
    : {
    "
    p
    s
    r
    -
    4
    "
    : {
    "
    "
    : "
    s
    r
    c
    /
    "
    }
    }

    View Slide

  28. Autoloading via Composer
    # c
    o
    m
    p
    o
    s
    e
    r
    .
    j
    s
    o
    n
    "
    a
    u
    t
    o
    l
    o
    a
    d
    "
    : {
    "
    p
    s
    r
    -
    4
    "
    : {
    "
    D
    r
    u
    p
    a
    l
    C
    a
    m
    p
    s
    \
    \
    "
    : "
    s
    r
    c
    /
    "
    }
    }

    View Slide

  29. src/GoCommand.php
    u
    s
    e S
    y
    m
    f
    o
    n
    y
    \
    C
    o
    m
    p
    o
    n
    e
    n
    t
    \
    C
    o
    n
    s
    o
    l
    e
    \
    C
    o
    m
    m
    a
    n
    d
    \
    C
    o
    m
    m
    a
    n
    d
    ;
    c
    l
    a
    s
    s G
    o
    C
    o
    m
    m
    a
    n
    d e
    x
    t
    e
    n
    d
    s C
    o
    m
    m
    a
    n
    d
    {
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n c
    o
    n
    f
    i
    g
    u
    r
    e
    (
    )
    {
    $
    t
    h
    i
    s
    -
    >
    s
    e
    t
    N
    a
    m
    e
    (
    '
    g
    o
    '
    )
    -
    >
    s
    e
    t
    D
    e
    s
    c
    r
    i
    p
    t
    i
    o
    n
    (
    '
    G
    o t
    o a D
    r
    u
    p
    a
    l
    C
    a
    m
    p
    .
    '
    )
    ;
    }
    }

    View Slide

  30. src/GoCommand.php (cont)
    u
    s
    e S
    y
    m
    f
    o
    n
    y
    \
    C
    o
    m
    p
    o
    n
    e
    n
    t
    \
    C
    o
    n
    s
    o
    l
    e
    \
    I
    n
    p
    u
    t
    \
    I
    n
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e
    ;
    u
    s
    e S
    y
    m
    f
    o
    n
    y
    \
    C
    o
    m
    p
    o
    n
    e
    n
    t
    \
    C
    o
    n
    s
    o
    l
    e
    \
    O
    u
    t
    p
    u
    t
    \
    O
    u
    t
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e
    ;
    .
    .
    .
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n e
    x
    e
    c
    u
    t
    e
    (
    I
    n
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    i
    n
    p
    u
    t
    , O
    u
    t
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    o
    u
    t
    p
    u
    t
    )
    {
    /
    / E
    x
    e
    c
    u
    t
    e t
    h
    e c
    o
    m
    m
    a
    n
    d
    .
    }

    View Slide

  31. bin/drupalcamp.php
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n = n
    e
    w A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    (
    )
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    -
    >
    a
    d
    d
    (
    n
    e
    w G
    o
    C
    o
    m
    m
    a
    n
    d
    (
    )
    )
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    -
    >
    r
    u
    n
    (
    )
    ;

    View Slide

  32. bin/drupalcamp.php
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n = n
    e
    w A
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    (
    )
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    -
    >
    a
    d
    d
    C
    o
    m
    m
    a
    n
    d
    s
    (
    [
    n
    e
    w G
    o
    C
    o
    m
    m
    a
    n
    d
    (
    )
    ,
    ]
    )
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    -
    >
    r
    u
    n
    (
    )
    ;

    View Slide

  33. View Slide

  34. Arguments and Options

    View Slide

  35. src/GoCommand.php
    u
    s
    e S
    y
    m
    f
    o
    n
    y
    \
    C
    o
    m
    p
    o
    n
    e
    n
    t
    \
    C
    o
    n
    s
    o
    l
    e
    \
    I
    n
    p
    u
    t
    \
    I
    n
    p
    u
    t
    A
    r
    g
    u
    m
    e
    n
    t
    ;
    .
    .
    .
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n c
    o
    n
    f
    i
    g
    u
    r
    e
    (
    )
    {
    $
    t
    h
    i
    s
    -
    >
    s
    e
    t
    N
    a
    m
    e
    (
    '
    g
    o
    '
    )
    -
    >
    s
    e
    t
    D
    e
    s
    c
    r
    i
    p
    t
    i
    o
    n
    (
    '
    G
    o t
    o a D
    r
    u
    p
    a
    l
    C
    a
    m
    p
    '
    )
    -
    >
    a
    d
    d
    A
    r
    g
    u
    m
    e
    n
    t
    (
    '
    n
    a
    m
    e
    '
    , I
    n
    p
    u
    t
    A
    r
    g
    u
    m
    e
    n
    t
    :
    :
    O
    P
    T
    I
    O
    N
    A
    L
    , '
    W
    h
    i
    c
    h D
    r
    u
    p
    a
    l
    C
    a
    m
    p
    ?
    '
    )
    -
    >
    a
    d
    d
    O
    p
    t
    i
    o
    n
    (
    '
    p
    a
    s
    t
    '
    , n
    u
    l
    l
    , I
    n
    p
    u
    t
    O
    p
    t
    i
    o
    n
    :
    :
    V
    A
    L
    U
    E
    _
    N
    O
    N
    E
    )
    ;
    }

    View Slide

  36. src/GoCommand.php (cont)
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n e
    x
    e
    c
    u
    t
    e
    (
    I
    n
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    i
    n
    p
    u
    t
    , O
    u
    t
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    o
    u
    t
    p
    u
    t
    )
    {
    $
    t
    e
    x
    t = $
    i
    n
    p
    u
    t
    -
    >
    g
    e
    t
    A
    r
    g
    u
    m
    e
    n
    t
    (
    '
    n
    a
    m
    e
    '
    )
    ;
    $
    p
    a
    s
    t = $
    i
    n
    p
    u
    t
    -
    >
    g
    e
    t
    O
    p
    t
    i
    o
    n
    (
    '
    p
    a
    s
    t
    '
    )
    ;
    .
    .
    .
    }

    View Slide

  37. View Slide

  38. Input and Output

    View Slide

  39. InputInterface
    $
    i
    n
    p
    u
    t
    -
    >
    g
    e
    t
    A
    r
    g
    u
    m
    e
    n
    t
    (
    '
    f
    o
    o
    '
    )
    ;
    $
    i
    n
    p
    u
    t
    -
    >
    g
    e
    t
    O
    p
    t
    i
    o
    n
    (
    '
    b
    a
    r
    '
    )
    ;

    View Slide

  40. OutputInterface
    $
    o
    u
    t
    p
    u
    t
    -
    >
    w
    r
    i
    t
    e
    (
    $
    t
    e
    x
    t
    )
    ;
    $
    o
    u
    t
    p
    u
    t
    -
    >
    w
    r
    i
    t
    e
    l
    n
    (
    $
    t
    e
    x
    t
    )
    ;

    View Slide

  41. OutputInterface
    $
    o
    u
    t
    p
    u
    t
    -
    >
    w
    r
    i
    t
    e
    (
    "
    <
    i
    n
    f
    o
    >
    $
    t
    e
    x
    t
    <
    /
    i
    n
    f
    o
    >
    "
    )
    ;
    $
    o
    u
    t
    p
    u
    t
    -
    >
    w
    r
    i
    t
    e
    (
    "
    <
    e
    r
    r
    o
    r
    >
    $
    t
    e
    x
    t
    <
    /
    e
    r
    r
    o
    r
    >
    "
    )
    ;
    $
    o
    u
    t
    p
    u
    t
    -
    >
    w
    r
    i
    t
    e
    (
    "
    <
    d
    e
    b
    u
    g
    >
    $
    t
    e
    x
    t
    <
    /
    d
    e
    b
    u
    g
    >
    "
    )
    ;

    View Slide

  42. SymfonyStyle
    title
    section
    text
    comment
    note
    caution
    table
    ask
    askHidden
    con rm
    choice
    success
    error
    warning

    View Slide

  43. SymfonyStyle
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n e
    x
    e
    c
    u
    t
    e
    (
    I
    n
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    i
    n
    p
    u
    t
    , O
    u
    t
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    o
    u
    t
    p
    u
    t
    )
    {
    $
    i
    o = n
    e
    w S
    y
    m
    f
    o
    n
    y
    S
    t
    y
    l
    e
    (
    $
    i
    n
    p
    u
    t
    , $
    o
    u
    t
    p
    u
    t
    )
    ;
    $
    i
    o
    -
    >
    t
    a
    b
    l
    e
    (
    [
    '
    T
    i
    t
    l
    e
    '
    , '
    S
    p
    e
    a
    k
    e
    r
    '
    ]
    ,
    [
    [
    '
    D
    r
    u
    p
    a
    l V
    M
    , M
    e
    e
    t S
    y
    m
    f
    o
    n
    y C
    o
    n
    s
    o
    l
    e
    '
    , '
    O
    l
    i
    v
    e
    r D
    a
    v
    i
    e
    s
    '
    ]
    ,
    [
    '
    D
    r
    u
    p
    a
    l 8 a
    n
    d t
    h
    e S
    y
    m
    f
    o
    n
    y E
    v
    e
    n
    t
    D
    i
    s
    p
    a
    t
    c
    h
    e
    r
    '
    , '
    E
    r
    i
    c S
    m
    i
    t
    h
    '
    ]
    ,
    [
    '
    B
    u
    i
    l
    d
    i
    n
    g w
    i
    t
    h A
    P
    I
    s
    '
    , '
    N
    i
    g
    e
    l D
    u
    n
    n
    '
    ]
    ,
    ]
    )
    ;
    }

    View Slide

  44. View Slide

  45. Interaction

    View Slide

  46. src/GoCommand.php
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n i
    n
    t
    e
    r
    a
    c
    t
    (
    I
    n
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    i
    n
    p
    u
    t
    , O
    u
    t
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    o
    u
    t
    p
    u
    t
    )
    {
    $
    i
    o = n
    e
    w S
    y
    m
    f
    o
    n
    y
    S
    t
    y
    l
    e
    (
    $
    i
    n
    p
    u
    t
    , $
    o
    u
    t
    p
    u
    t
    )
    ;
    i
    f (
    !
    $
    i
    n
    p
    u
    t
    -
    >
    g
    e
    t
    A
    r
    g
    u
    m
    e
    n
    t
    (
    '
    n
    a
    m
    e
    '
    )
    ) {
    $
    i
    n
    p
    u
    t
    -
    >
    s
    e
    t
    A
    r
    g
    u
    m
    e
    n
    t
    (
    '
    n
    a
    m
    e
    '
    , $
    i
    o
    -
    >
    a
    s
    k
    (
    '
    W
    h
    i
    c
    h D
    r
    u
    p
    a
    l
    C
    a
    m
    p
    ?
    '
    )
    )
    ;
    }
    }

    View Slide

  47. src/GoCommand.php
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n e
    x
    e
    c
    u
    t
    e
    (
    I
    n
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    i
    n
    p
    u
    t
    , O
    u
    t
    p
    u
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    o
    u
    t
    p
    u
    t
    )
    {
    $
    i
    o = n
    e
    w S
    y
    m
    f
    o
    n
    y
    S
    t
    y
    l
    e
    (
    $
    i
    n
    p
    u
    t
    , $
    o
    u
    t
    p
    u
    t
    )
    ;
    $
    i
    o
    -
    >
    s
    u
    c
    c
    e
    s
    s
    (
    $
    i
    n
    p
    u
    t
    -
    >
    g
    e
    t
    A
    r
    g
    u
    m
    e
    n
    t
    (
    '
    n
    a
    m
    e
    '
    )
    )
    ;
    }

    View Slide

  48. Dependency Injection

    View Slide

  49. Dependency Injection
    Instantiate dependencies in single place or DI
    container
    Add as arguments when adding commands
    Add as arguments to the constructor and assign
    to properties
    Make sure to call the __construct() method within
    the parent class.

    View Slide

  50. src/Console/Application.php
    u
    s
    e G
    u
    z
    z
    l
    e
    H
    t
    t
    p
    \
    C
    l
    i
    e
    n
    t
    ;
    .
    .
    .
    $
    c
    l
    i
    e
    n
    t = n
    e
    w C
    l
    i
    e
    n
    t
    (
    )
    ;
    $
    a
    p
    p
    l
    i
    c
    a
    t
    i
    o
    n
    -
    >
    a
    d
    d
    (
    n
    e
    w N
    e
    w
    C
    o
    m
    m
    a
    n
    d
    (
    $
    c
    l
    i
    e
    n
    t
    )
    )
    ;

    View Slide

  51. src/Command/NewCommand.php
    u
    s
    e G
    u
    z
    z
    l
    e
    H
    t
    t
    p
    \
    C
    l
    i
    e
    n
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e
    ;
    u
    s
    e S
    y
    m
    f
    o
    n
    y
    \
    C
    o
    m
    p
    o
    n
    e
    n
    t
    \
    C
    o
    n
    s
    o
    l
    e
    \
    C
    o
    m
    m
    a
    n
    d
    ;
    f
    i
    n
    a
    l c
    l
    a
    s
    s N
    e
    w
    C
    o
    m
    m
    a
    n
    d e
    x
    t
    e
    n
    d
    s C
    o
    m
    m
    a
    n
    d
    {
    p
    r
    i
    v
    a
    t
    e $
    c
    l
    i
    e
    n
    t
    ;
    p
    u
    b
    l
    i
    c f
    u
    n
    c
    t
    i
    o
    n _
    _
    c
    o
    n
    s
    t
    r
    u
    c
    t
    (
    C
    l
    i
    e
    n
    t
    I
    n
    t
    e
    r
    f
    a
    c
    e $
    c
    l
    i
    e
    n
    t
    )
    {
    p
    a
    r
    e
    n
    t
    :
    :
    _
    _
    c
    o
    n
    s
    t
    r
    u
    c
    t
    (
    )
    ;
    $
    t
    h
    i
    s
    -
    >
    c
    l
    i
    e
    n
    t = $
    c
    l
    i
    e
    n
    t
    ;
    }
    }

    View Slide

  52. Distributing Your Application

    View Slide

  53. .phar les
    PHP archive le
    Packages your application into one le
    b
    o
    x b
    u
    i
    l
    d

    View Slide

  54. Generating phar les
    # c
    o
    m
    p
    o
    s
    e
    r
    .
    j
    s
    o
    n
    "
    s
    c
    r
    i
    p
    t
    s
    "
    : {
    "
    b
    u
    i
    l
    d
    "
    : [
    "
    b
    o
    x b
    u
    i
    l
    d
    "
    ,
    "
    s
    h
    a
    s
    u
    m d
    r
    u
    p
    a
    l
    v
    m
    .
    p
    h
    a
    r |
    a
    w
    k '
    {
    p
    r
    i
    n
    t $
    1
    }
    ' > d
    r
    u
    p
    a
    l
    v
    m
    .
    p
    h
    a
    r
    .
    v
    e
    r
    s
    i
    o
    n
    "
    ]
    }
    $ c
    o
    m
    p
    o
    s
    e
    r r
    u
    n
    -
    s
    c
    r
    i
    p
    t b
    u
    i
    l
    d

    View Slide

  55. Roadmap
    Keep up to date with Drupal VM stable releases
    New commands - updating existing les, adding
    vhosts
    Improve user defaults and settings

    View Slide

  56. Resources
    https://github.com/opdavies/drupal-vm-
    generator
    https://www.drupalvmgenerator.com
    http://bit.ly/announcing-drupal-vm-generator
    http://symfony.com/doc/current/components
    http://symfony.com/doc/current/cookbook/console

    View Slide

  57. Questions?

    View Slide

  58. Feedback
    @opdavies
    https://www.oliverdavies.uk

    View Slide