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 # 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. 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 # The Lowdown
- Any set within `{projectDirectory}/spinner.yaml`
- Fall back to `/config/spinner.yaml`
# 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 # Installation
>
> **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`
> #### Argument: path Pre-Requisites:
>
> **Required?**
>
> The **absolute path** on your system to the project you want to create containers for.
### Options - Composer
- Docker Desktop/Docker Engine
> #### Option: --php ```shell
> composer global require loomlabs/loom-spinner-cli
> 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`
> #### Option: --node # Usage
>
> Set which version of Node to install in your container. Equivalent to setting `options.environment.node.version: x`
> in your projects Spinner config.
> #### Option: --database Start your (Docker) engines, then:
>
> 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.
> #### Option: --disable-database ```shell
> cd /path/to/my-project
> Does not install a database with your environment. Equivalent to setting `options.environment.database.enabled: false` loom spin:up my-project .
> in your Spinner config. ```
> #### Option: --disable-server Check your new containers ports by inspecting the containers in Docker Desktop or running `docker ps`.
>
> Does not install a webserver (so no Nginx). Useful if you just need a PHP container to run unit tests or something.
> #### Option: --disable-xdebug Your projects public directory is now available at `http://localhost:<nginx-container-port>`. Voila!
>
> Do not install XDebug in your environment. Equivalent to setting `options.environment.php.xdebug = false` in your
> projects Spinner config.
## Command: `spin:down` ## What Else?
Destroys a named environment; containers and Spinner config. Want to stop your containers?
> #### Argument: name ```shell
> loom spin:stop my-project
> **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`
## XDebug Setup Start them again?
These instructions are for PHPStorm. I don't know about working with other IDE's, although they ```shell
should be fairly universal. loom spin:start my-project
```
### Server Settings Destroy your containers?
- `File` -> `Settings` ```shell
- `PHP` -> `Servers` -> `+` loom spin:down my-project
- Give your "server" a name and use the values shown below. ```
| Setting | Value | 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.
| 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 |
### Remote Debugger Happy spinning! 🧵
- `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.

View file

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