Search by

webservco / component-common

ariademur

Common dependencies for component projects.

Package info

github.com/webservco/component-common

Homepage

Language:Dockerfile

pkg:composer/webservco/component-common

Statistics

Installs: 290

Dependents: 43

Suggesters: 0

Stars: 0

Open Issues: 0

v2.3.0 2026-10-11 16:34 UTC

This package is auto-updated.

Last update: 2026-10-11 16:45:38 UTC


README

Common dependencies for component projects. It holds the shared PHP_CodeSniffer ruleset (.phpcs/php-coding-standard.xml, which extends webservco/coding-standards with the component namespaces) and the Docker configuration.

Component workflow

Create project repository

  • public
  • leave every other option unchecked (no README, license or .gitignore). The repository has to start empty.

Set up project name

COMPONENT_NAME='COMPONENT_NAME';

Run customization commands (clone component-skeleton)

cd ~/p/webservco-components && \
git clone git@github.com:webservco/component-skeleton.git $COMPONENT_NAME && \
cd $COMPONENT_NAME && \
git remote set-url origin git@github.com:webservco/$COMPONENT_NAME.git && \
sed -i -e "s|component-skeleton|$COMPONENT_NAME|g" README.md && \
sed -i -e "s|\"name\" : \"webservco/component-skeleton\"|\"name\" : \"webservco/$COMPONENT_NAME\"|g" composer.json && \
sed -i -e "s|name: component-skeleton|name: $COMPONENT_NAME|g" .ddev/config.yaml && \
git add README.md composer.json .ddev/config.yaml && \
git commit -m 'Customize' && \
git push -u origin main

The skeleton already contains every directory the checks expect (bin, config, docs, public, resources, src/WebServCo, tests/Unit/WebServCo), each kept in git by an empty .gitkeep.

Add code

  • Code goes in src/WebServCo/ (namespace WebServCo\), unit tests in tests/Unit/ (namespace Tests\Unit\).
  • Delete a directory's .gitkeep once it holds real files.
  • Fill in the README template. The hidden comment at the top of the file explains how; delete it and the template note when done.
  • Set description in composer.json to the README description ("A PHP component/library." plus one sentence).

Development

# Start project.
ddev start
# Install dependencies.
ddev c u
# Run all validations.
ddev c c
# Run unit tests.
ddev c test:dox

Without ddev (Docker)

Use this only when you can't set up a local environment. Working through Docker this way is more cumbersome.

# Customize
DOCKER_IMAGE_TAG="webservco-component-${COMPONENT_NAME}";
DOCKER_CONTAINER_NAME="webservco-component-${COMPONENT_NAME}-container";

# Download Docker configuration
curl -sL https://github.com/webservco/component-common/archive/refs/heads/main.tar.gz \
    | tar xz --strip-components=1 component-common-main/.docker

# Build and run
docker build --tag ${DOCKER_IMAGE_TAG} -f .docker/config/php84-cli-copy/Dockerfile .
docker run -it --rm --name ${DOCKER_CONTAINER_NAME} ${DOCKER_IMAGE_TAG} /bin/bash -c "composer check:phpcs"

# Cleanup
docker image rm ${DOCKER_IMAGE_TAG}

Add dependencies

Publish tag

git tag vX.Y.Z && git push --tags

Publish on packagist

Update index

Index

Misc

Components