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

What's in Your Project Root?

What's in Your Project Root?

Let me ask you a question... What’s in *your* project root? If you take a look at PHP projects hosted on GitHub, you’ll find a plethora of configuration and other files in the project's root directory that are made out of everything. There’s JSON, Markdown, YAML, XML, and even some PHP (phew). Let’s talk about what all of these files do and what things you might be missing out on. From Composer to PHPUnit and from Travis to Phing, there are plenty of tools you can configure to improve the quality of your project, some with very little effort.

Jeremy Lindblom

March 14, 2015
Tweet

More Decks by Jeremy Lindblom

Other Decks in Programming

Transcript

  1. ls

  2. EVERYTHING NEEDED TO CODE, TEST, BUILD, & DEPLOY… THAT'S NOT

    SENSITIVE! ★★★★★★★★★★★★★★
  3. — I work at — — on the — AWS

    SDK for PHP @awsforphp ★ aws/aws-sdk-php
  4. “My $500 Cloud Security Screwup“ “My $2375 Amazon EC2 Mistake“

    “Attackers Scrape GitHub For Cloud Service Credentials, Hijack Account To Mine Virtual Currency“
  5. AWS Identity and Access Management We encourage the use of

    IAM User/Role credentials instead of root-level credentials
  6. •  Use IAM instance profile credentials on EC2 •  Use

    a global credential file in your $HOME •  Use environment variables (e.g., getenv) In the AWS SDK, we document ways to…
  7. Why is it in your project root? †Does not apply

    to any actual PHP projects that I'm aware of.
  8. LICENSE(\.md)? MIT, BSD, GPL, LGPL, Apache 2, etc. LICENSES DEFINE

    THE TERMS FOR HOW OPEN SOURCE SOFTWARE CAN BE USED, MODIFIED, AND SHARED. Need help? choosealicense.com
  9. CHANGELOG.md # My Project ## 1.2.6 ### Changed - Added

    super-awesome rainbow function. Need help? keepachangelog.com semver.org
  10. $ cat composer.json { "require": { "guzzlehttp/guzzle": "~5.0", "monolog/monolog": "~1.12.0"

    }, "require-dev": { "phpunit/phpunit": "~4.0" }, "autoload": { "psr-4":{"League\\Http\\":"src/"} } }
  11. $ cat .gitattributes /tests export-ignore /vendor export-ignore /demos export-ignore .gitattributes

    export-ignore .gitignore export-ignore .travis.yml export-ignore build.xml export-ignore
  12. Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" config.vm.provider "virtualbox" do |vb|

    vb.memory = "2048" end config.vm.provision "shell", inline: <<-SHELL sudo apt-get update sudo apt-get install -y apache2 git hhvm sudo service apache2 restart sudo service hhvm restart SHELL end
  13. language: php php: - 5.5 - 5.6 - 7.0 -

    hhvm install: composer install script: vendor/bin/phpunit matrix: allow_failures: - php: 7.0 - php: hhvm fast_finish: true
  14. CODE DOCS TESTS BUILD DEPLOY TEXT MD JSON XML YAML

    INI BASH RUBY README.md LICENSE composer.json .gitignore .gitattributes phpunit.xml build.xml Vagrantfile .scrutinizer.yml .travis.yml
  15. CODE DOCS TESTS BUILD DEPLOY TEXT MD JSON XML YAML

    INI BASH RUBY README.md LICENSE composer.json .gitignore .gitattributes phpunit.xml build.xml Vagrantfile .scrutinizer.yml .travis.yml NO CREDENTIALS!!!
  16. Resources •  h"ps://github.com/thephpleague/skeleton   •  h"ps://travis-­‐ci.org/   •  h"ps://scru9nizer-­‐ci.com/  

    •  h"p://choosealicense.com/   •  h"p://opensource.org/licenses   •  h"p://keepachangelog.com/   •  h"p://semver.org/   •  h"p://vagrantup.com/   •  h"ps://phpunit.de/manual/current/en/appendixes.configura9on.html   •  h"ps://www.phing.info/   •  h"p://www.phpdoc.org/   •  h"ps://help.github.com/ar9cles/github-­‐flavored-­‐markdown/   •  h"ps://github.com/aws/aws-­‐sdk-­‐php