Shift API

Shift now offers an API for users subscribing to a Shifty Plan. The Shift API allows you to trigger Shifts to run against your Laravel applications by using a traditional HTTP API or webhooks.

HTTP API

Each Shifty Plan provides access to the /api/run endpoint. Using this endpoint you can trigger Shifts to run as part of your build, a weekly audit, or on-demand.

Currently the Shift API allows you to run the follow Shifts:

To run a Shift, send a POST request to https://laravelshift.com/api/run with the following data:

  • api_token Your Shifty Plan API token
  • code The code of the Shift you wish to run. For example:
    • 70 for the Laravel 7.x Shift
    • LL for the Laravel Linter
    • LF for the Laravel Fixer
    • DU for the Dependency Updater
    • P2 for the PSR-2
  • scs The Git service, repository, and branch name as a colon (:) delimited connection string. For example:
    • github:laravel-shift/bot:master
    • bitbucket:pureconcepts/workshops:develop
    • gitlab:jasonmccreary/blog:feature-branch

The following is an example API request using curl to run the Laravel Fixer against the master branch of the jasonmccreary/confidentlaravel.com repository on GitHub. You may use this example by substituting the request data with your own API Key and values.

curl -X POST -H 'Accept: application/json' \
    -d "api_token=1234567890" \
    -d "code=60" \
    -d "scs=github:jasonmccreary/gettinggit.com:master" \
    https://laravelshift.com/api/run

Webhooks

Each Shifty Plan allows you to set up webhooks to perform an automated code review of your changes by running a customizable version of the Laravel Fixer anytime you open a Pull Request.

To do so, you may register a webhook for any repository included under your plan with the following details:

  • Set the webhook URL to your Shifty Plan endpoint, for example: https://laravelshift.com/api/webhook/1234567890
  • Ensure the payload is sent as application/json
  • Under Events, only check the Pull Request event (Merge Request for GitLab)

For additional details on registering a webhook for your repository, review the specific documentation for GitHub, Bitbucket, or GitLab.

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.