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. You may also make calls to the HTTP API to add or remove repositories on your Shifty Plan.
While you may use the web UI, Shift definitely understands the desire to automate common tasks. As such, Shift offers an HTTP API for you to do so. All calls to the HTTP API must be authenticated. You may do so by passing your your Shifty Plan API token which was included in your welcome email. If you no longer have it, you may email support to have it reset.
You may call the /api/run
endpoint to run a Shift as part of your build, a weekly audit, or on-demand. Currently, you may run the following 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 tokencode
The code of the Shift you wish to run. For example:
11
for the Laravel 11.x Shift10
for the Laravel 10.x ShiftLL
for the Laravel LinterLF
for the Laravel FixerDU
for the Dependency UpgraderCF
for the Code Formatterscs
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/gettinggit.com
repository on GitHub.
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
Want to quickly convert this curl
command to an Http
call within your Laravel applications? Check out Shift's free curl to HTTP online converter.
To list all repositories on your Shifty Plan, send a GET
request to https://laravelshift.com/api/repository and include your Shifty Plan api_token
in the header of the request.
The following is an example API request using curl
to retrieve a list of your Shifty Plan repositories. You may use this example by substituting the Bearer
header value with your own API Key.
curl -H 'Accept: application/json' \
-H "Authorization: Bearer 1234567890" \
https://laravelshift.com/api/repository
To add a repository to your Shifty Plan, send a POST
request to https://laravelshift.com/api/repository with the following data:
api_token
Your Shifty Plan API tokenservice
The Git service where the repository is hosted. For example: GitHub
, Bitbucket
, or GitLab
repository
The repository. For example: jasonmccreary/baselaravel.com
branch
The default source branch to use. For example: main
, master
, develop
automation
A boolean to enable or disable automation. This is optional and disabled by default.The following is an example API request using curl
to add the jasonmccreary/baselaravel.com
repository on GitHub with a default branch of main
to a Shifty Plan and enable automation
. 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 "service=GitHub" \
-d "repository=github:jasonmccreary/baselaravel.com" \
-d "branch=main" \
-d "automation=1"
https://laravelshift.com/api/repository
To remove a repository from your Shifty Plan, send a DELETE
request to https://laravelshift.com/api/repository with the following data:
api_token
Your Shifty Plan API tokenservice
The Git service where the repository is hosted. For example: GitHub
, Bitbucket
, or GitLab
repository
The repository. For example: jasonmccreary/confidentlaravel.com
The following is an example API request using curl
to remove the jasonmccreary/confidentlaravel.com
repository on GitHub from a Shifty Plan. You may use this example by substituting the request data with your own API Key and values.
curl -X DELETE -H 'Accept: application/json' \
-d "api_token=1234567890" \
-d "service=GitHub" \
-d "repository=github:jasonmccreary/confidentlaravel.com"
https://laravelshift.com/api/repository
Each Shifty Plan allows you to set up webhooks to perform an automated code review of your changes by running the Laravel Fixer or custom set of tasks anytime you open a PR.
To do so, you may register a webhook for any repository included under your plan with the following details:
https://laravelshift.com/api/webhook/1234567890
application/json
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.