Update README, update composer.json

This commit is contained in:
Daniel Winning 2025-04-24 03:15:08 +01:00
parent 13b27e0ec0
commit 42a6c0b7a6
3 changed files with 56 additions and 88 deletions

135
README.md
View file

@ -1,112 +1,79 @@
# Loom | Spinner
<div>
<!-- Version Badge -->
<img src="https://img.shields.io/badge/Version-1.0.0-blue" alt="Version 1.1.0">
</div>
An environment management application for PHP developers.
# Dev Notes
Allows you to spin up minimal, sensibly pre-configured Docker
containers for PHP development, for a fast, consistent and smooth development experience.
**Argument priority:**
Simple commands you can run from anywhere on your system.
- Those passed explicitly in the CLI commands
- Any set within `{projectDirectory}/spinner.yaml`
- Fall back to `/config/spinner.yaml`
# The Lowdown
# Commands
Create pre-configured Docker environments on a project-by-project basis, tailored specifically for developing PHP
applications. The default setup gives you an environment with:
## Command: `spin:up`
- PHP 8.4 (with XDebug + OpCache)
- Nginx
- SQLite3
- NodeJS 23 (Node, NPM + NPX)
Creates a new PHP development environment and mounts your project files.
Your project is mounted to the PHP container and your projects `public` directory is served via Nginx at
`http://localhost:<nginx-port>` and your container is accessible via the command line for things like running
unit tests.
### Arguments
**Loom Spinner CLI is currently in the early stages of development and thus only has limited features, such as the
only database option currently being SQLite. More options will be added in subsequent releases.**
> #### Argument: name
>
> **Required?**
>
> The name of your Docker containers. Your containers will spin up with the name {name}-{service} i.e.
>
> `spinner spin:up name=test path=/path`
>
> Results in containers named `test-php` and `test-nginx`
# Installation
> #### Argument: path
>
> **Required?**
>
> The **absolute path** on your system to the project you want to create containers for.
Pre-Requisites:
### Options
- Composer
- Docker Desktop/Docker Engine
> #### Option: --php
>
> Defines the PHP version that your container will use. You can omit this flag and set the PHP version inside your
> projects `spinner.yaml` file. Otherwise, will use the default value found in `config/spinner.yaml`
```shell
composer global require loomlabs/loom-spinner-cli
```
> #### Option: --node
>
> Set which version of Node to install in your container. Equivalent to setting `options.environment.node.version: x`
> in your projects Spinner config.
# Usage
> #### Option: --database
>
> Set which database driver to use with your environment. The default (and currently only) database driver is `sqlite3`.
> Accepted values are currently `sqlite` and `sqlite3`. If using the default, SQLite is installed inside your PHP
> container and a mapping created to the `/sqlite` directory in your project. This argument is ignored if
> `--disabled-database` is set.
Start your (Docker) engines, then:
> #### Option: --disable-database
>
> Does not install a database with your environment. Equivalent to setting `options.environment.database.enabled: false`
> in your Spinner config.
```shell
cd /path/to/my-project
loom spin:up my-project .
```
> #### Option: --disable-server
>
> Does not install a webserver (so no Nginx). Useful if you just need a PHP container to run unit tests or something.
Check your new containers ports by inspecting the containers in Docker Desktop or running `docker ps`.
> #### Option: --disable-xdebug
>
> Do not install XDebug in your environment. Equivalent to setting `options.environment.php.xdebug = false` in your
> projects Spinner config.
Your projects public directory is now available at `http://localhost:<nginx-container-port>`. Voila!
## Command: `spin:down`
## What Else?
Destroys a named environment; containers and Spinner config.
Want to stop your containers?
> #### Argument: name
>
> **Required?**
>
> The name of the containers and associated config that you wish to delete. Use the same name you used when you
> span up your containers with the `spin:up` command.
>
> `spinner spin:down name=project-name`
```shell
loom spin:stop my-project
```
## XDebug Setup
Start them again?
These instructions are for PHPStorm. I don't know about working with other IDE's, although they
should be fairly universal.
```shell
loom spin:start my-project
```
### Server Settings
Destroy your containers?
- `File` -> `Settings`
- `PHP` -> `Servers` -> `+`
- Give your "server" a name and use the values shown below.
```shell
loom spin:down my-project
```
| Setting | Value |
|-------------------------|----------------------------------------------------------------------------------------------------------------|
| Host | 127.0.0.1 |
| Port | **Local** port **PHP** container is running on. i.e. if your docker container shows 52033:9003, use **52033**. |
| Debugger | Xdebug |
| Use path mappings? | ✅ |
| File/Directory | Select **your project root** |
| Absolute path on server | /var/www/html |
What's more, `loom` can be configured further with a simple set of configuration options. For a more detailed
quick-start guide or for more information on using and configuring **Loom Spinner CLI**, please consult the wiki.
### Remote Debugger
- `Run` -> `Edit Configurations`
- `+` -> `PHP Remote Debug`
- Give it a name
- Use the server you created before
- Use **SPINNER** as IDE key
Make sure you start listening when you want to debug by clicking the little bug icon in the
top right (by default) in PHPStorm.
Happy spinning! 🧵

View file

@ -1,7 +1,7 @@
{
"name": "loomlabs/spinner",
"name": "loomlabs/loom-spinner-cli",
"decsription": "A simple command-line Docker environment spinner for PHP",
"version": "0.1.0",
"version": "1.0.0",
"autoload": {
"psr-4": {
"Loom\\Spinner\\": "src/"
@ -21,6 +21,7 @@
"phpunit/phpunit": "^12.1"
},
"bin": [
"bin/spinner"
]
"bin/loom"
],
"license": "GPL-3.0-or-later"
}