Creating a github repo

  • To create new repository in GitHub visit this page. Where you will need to fill repository name, description, make it public and click "Create repository" button.
  • Add github remote and push all the changes git remote add origin And push all the changes git push origin master


Creating a release

  • Go to your repository and click "Releases" tab
  • Then click the button "Create a new release"
  • Then in Tag version field insert version. You can read more about semantinc versioning here.
  • Fill in Release title, and write short description.
  • Once you have done all above steps. Press "Publish Release".

That is it, you have published your first release. To confirm that it's really published, visit your repository page "Releases" tab and you should see your newly created release.

Deleting a release

To delete a release click on release heading for example "Initial Release" and then click "Delete" button.

Editing a release

Click on release heading and then click "Edit Release" button.

Pull Requests

Creating Pull Requests in GitHub is a good way of ensuring that the tests you have setup are triggered before you merge any changes into the LIVE / master branch.

This will detail how to use them

Work on your branch

First you need to create your branch and work on it as you normally would.

Once the changes are ready to be merged in, push the branch up to GitHub.

Create the Pull Request

From the repo page on GitHub, click the Pull Requests link in the top menu.

This will take you to a page of open PRs.

Click the green New pull request button, and you will be presented with a helpful list of suggested options to use as the base of your PR

Assuming you have just pushed changes to your branch you should see it near the top of the list. If it is not there, then select it in the compare drop down


When you push changes to GitHub it gives you the link to create a pull request.

Check the changes

At this point you will be able to look at the changes that will be made, before formally creating the request. Use this opportunity to make sure there aren't any silly mistakes, and then click the create pull request button.

Add any useful comments at this point explaining what was done, and try to link through to a ticket if one exists.

Allow the tests to run

The request will be sent to be tested, and other checks may need to be carried out depending on how the repo has been set up. People may make comments on the request asking for explanations or requesting changes

Merging the commit

As long as everything passes, it is then possible to merge the PR into the branch. Once this is done make sure to click the purple button to delete the old branch

To do this: - view the pull request select the pull request's button on the Github Repo:

Pull Request Button

  • Then check that the test's have been passing:

Checks Passed

  • Before the merging this, check changes to the pull request this will give you an opportunity to add comments to things you believe can be improved

Checks Passed

  • You will be able to add comments to lines of edited files by pressing the "+" button next to the line you believe needs to be commented on.

Add comment to line

Adding SSH Keys for accessing a repo

Log in to the github account which owns the repo and navigate to settings (top right corner) and then SSH and GPG Keys.

From here you will be able to add a new SSH key to the account.


Setting Up New GitHub Repo with Scrutinizer, Travis, CI, and PHPQA

Local setup

Once you've created your new repo

  1. Clone it down into a development container


  1. Change Directory to your repo and create files and folder structure - adding git keeps to allow empty folders
  2. cd path/to/repo ; mkdir src ; mkdir tests ;
  3. touch src/.gitkeep;touch tests/.gitkeep;
  4. Create a with the title of your project touch; echo #Reponame >;
  5. git add -A ./; git commit -m "Initial Commit"; git push origin master, Git add,commit & push back up to GitHub Remote


  1. Copy the travis and ci configurations we use on other projects

    • .travis.yml
    • .scrutinizer.yml
    • qaConfig - copy folder and only ci/travis folder and just the phpstan.neon file.
    • ci.bash
  2. Run Composer require to set up composer files : composer require edmondscommerce/phpqa:dev-master@dev --dev

  3. Add to autoload and config to composer.json - config needed for ./bin/qa command.

      "autoload": {
        "psr-4": {
          "$YOURNAMESPACE\\": [
      "autoload-dev": {
        "psr-4": {
          "$YOURNAMESPACE\\Tests\\": [
      "config": {
        "bin-dir": "bin"

  4. Add your php files to src and tests to tests.

  5. Run ./bin/qa if errors then try and fix locally.

Github config and CI

  1. On git hub head over to the GitHub settings on your repo.

Github Settings Image

  1. Head to the branches Tab to configure checks for a branch on your repo.

  2. Give the branch name you want checks on, in this case it is master

    • Tick the "Require status checks to pass before merging" option.
    • Tick the "Require branches to be up to date before merging" option.
    • Tick the "Include administrators" option.
  3. For the status checks to work you now need to log into the status checks sites to configure them to hook into these requests.


  • Add a new repository with the "+ Add Repository" button.
  • Fill the github repository - it will auto-fill if connected with your github.
  • Select the language
  • Do not tick option for the Tests/Coverage Label - We've added these ourselves.

After CI integrated

Once the following steps have been set up it's time to test they work.

  • Create a new branch on you're repo
  • Make some edits - ie. fix test coverage
  • Push new branch to remote
  • Check the pull request link in the command line, when pushed.
    • If there isn't one then log into github and make a new one

You should now see before allowing you to merge the branch that the status checks are running and if failed will not allow you to merge.