engelju/sandbox

Test how PHP worklflow stuff works

dev-master 2018-03-23 08:45 UTC

This package is not auto-updated.

Last update: 2024-10-12 20:00:53 UTC


README

This is a sandbox repo

Stuff tested out with this repo:

  • Git
  • Github
  • Multiple SSH Keys
  • Composer
  • PHPUnit
  • Packagist
  • Travis-ci
  • Webhooks

Badges:

Latest Stable Version Latest Unstable Version Build Status Travis

HOWTOs

Initial setup

  • Usual prerequisites installed
  • cd htdocs && mkdir helloworld && cd helloworld

Composer

jeng@macbook:/Applications/MAMP/htdocs/helloworld $ composer init

    Welcome to the Composer config generator  

    This command will guide you through creating your composer.json config.

    Package name (<vendor>/<name>) [engelju/helloworld]:

You can accept the default or customize it like "yourname/hello" or what you want. Complete all Composer questions like:

    Package name (<vendor>/<name>) [engelju/helloworld]: engelju/helloworld
    Description []: A test packages for composer and github
    Author [Junior Grossi <me@juniorgrossi.com>]: Julie Engel <julie.engel@mail.com>
    Minimum Stability []: dev

Define your dependencies.

    Would you like to define your dependencies (require) interactively [yes]? no
    Would you like to define your dev dependencies (require-dev) interactively [yes]? no

    {
        "name": "engelju/composer_github",
        "description": "A test packages for composer and github",
        "authors": [
            {
            "name": "Julie Engel",
            "email": "julie.engel@mail.com"
            }
        ],
        "minimum-stability": "dev",
        "require": {
        }
    }

    Do you confirm generation [yes]? yes

Then we have to make a few changes to your generated composer.json so that it will look like this:

{
    "name": "engelju/composer_github",
    "description": "A test packages for composer and github",
    "authors": [
        {
        "name": "Julie Engel",
        "email": "julie.engel@mail.com"
        }
    ],
    "license": "GPL",
    "autoload": {
        "psr-0": {
            "HelloWorld": "src/"
        }
    },
    "require": {
        "php": ">=5.3.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^4.8@dev"
    },
    "minimum-stability": "dev"
}

What we did here is add information about PHP 5.3 as minimum requirements (require section), as well as require phpunit in the dev section, and tell Composer to "autoload" (using PSR-0) all files with "HelloWorld" namespace that are inside "src" dir.

Then you can do a composer install and it will create a vendor-directory and install the components there.

File Structure / Code

  • mkdir src && mkdir tests
$ tree -L 3
.
├── .gitignore                      --> git ignore file
├── .travis.yml                     --> travis-ci config file
├── LICENSE                         --> first version auto-generated by github
├── README.md                       --> first version auto-generated by github
├── composer.json                   --> composer config file
├── composer.lock                   --> locks the current versions of the dependencies
├── src/                            --> directory where the actual code lies
│   └── HelloWorld/                 --> yay, namespacing
│       └── SayHello.php            --> actual class
├── tests/                          --> directory where our tests lie
│   ├── HelloWorld/                 --> mirroring the code dir sturcture
│   │   └── SayHelloTest.php        --> one test for each class
│   ├── bootstrap.php               --> phpunit bootstrap
│   └── phpunit.xml                 --> phpunit config file
└── vendor/                         --> dependencies, installed with `composer install`
    ├── autoload.php
    ├── bin/
    │   └── phpunit -> ../phpunit/phpunit/phpunit
    ├── composer/
    ├── doctrine/
    ├── phpdocumentor/
    ├── phpspec/
    ├── phpunit/
    ├── sebastian/
    └── symfony/

PHPUnit / Testing

Packagist

Git

  • Branches
  • Committing
  • Remotes

Multiple SSH Keys

Helpful docs:

Github

  • Issues
  • Pull Requests
    • Working on your own stuff
    • Contributing on other projects

Webhooks

Travis-CI