Appearance
Creating an internal package
All new packages should use the Spatie Laravel package template. Ensure the new repo is created in the morphsites/lib namespace on GitLab before continuing.
Set up the repository
Clone the template and remove its git history:
shell
git clone --depth=1 git@github.com:spatie/package-skeleton-laravel.git <package-slug>
rm -rf !$/.gitConnect to GitLab:
shell
cd <package-slug>
git init --initial-branch=main
git remote add origin git@gitlab.morphsites.net:morphsites/lib/<package-slug>.git
git add .
git commit -m "Initial commit"
git push -u origin mainConfigure the package
shell
php configure.phpUse the following settings:
- Author name: Your name
- Author email: Your morphsites email
- Author Username: morphsites
- Vendor name: morphsites
- Vendor namespace: Morphsites
- Package/Class name: keep it simple, remove any Laravel prefixes
- Phpstan: Y
- Pint: Y
- Dependabot: N
- Ray: Y
- Changelog: N
- Execute composer + run tests: Y
- Trust plugins
- Self delete script: Y
Publish to the registry
Add the following .gitlab-ci.yml to the repo root so the package is published to the registry on each tagged release:
yaml
stages:
- deploy
deploy:
image: alpine:latest
stage: deploy
only:
- tags
script:
- apk add curl
- 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=$CI_COMMIT_TAG "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"'
environment: productionCommit all changes and the package is ready for development.
Changelogs
Use marcocesarato/php-conventional-changelog to generate changelogs and version tags automatically from Conventional Commits. See the Git standards page for commit message guidelines.