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
An environment management application for PHP developers. <div>
<!-- Version Badge -->
<img src="https://img.shields.io/badge/Version-1.0.0-blue" alt="Version 1.1.0">
</div>
# Dev Notes An environment management application for PHP developers.
**Argument priority:** Allows you to spin up minimal, sensibly pre-configured Docker
containers for PHP development, for a fast, consistent and smooth development experience.
- Those passed explicitly in the CLI commands Simple commands you can run from anywhere on your system.
- Any set within `{projectDirectory}/spinner.yaml`
- Fall back to `/config/spinner.yaml`
# Commands # The Lowdown
## Command: `spin:up` 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:
Creates a new PHP development environment and mounts your project files. - PHP 8.4 (with XDebug + OpCache)
- Nginx
- SQLite3
- NodeJS 23 (Node, NPM + NPX)
### Arguments 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.
> #### Argument: name **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.**
> **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 # Installation
>
> **Required?**
>
> The **absolute path** on your system to the project you want to create containers for.
### Options Pre-Requisites:
> #### Option: --php - Composer
> - Docker Desktop/Docker Engine
> 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 ```shell
> composer global require loomlabs/loom-spinner-cli
> 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 # Usage
>
> 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 Start your (Docker) engines, then:
>
> Does not install a database with your environment. Equivalent to setting `options.environment.database.enabled: false`
> in your Spinner config.
> #### Option: --disable-server ```shell
> cd /path/to/my-project
> Does not install a webserver (so no Nginx). Useful if you just need a PHP container to run unit tests or something. loom spin:up my-project .
```
> #### Option: --disable-xdebug Check your new containers ports by inspecting the containers in Docker Desktop or running `docker ps`.
>
> Do not install XDebug in your environment. Equivalent to setting `options.environment.php.xdebug = false` in your
> projects Spinner config.
## Command: `spin:down` Your projects public directory is now available at `http://localhost:<nginx-container-port>`. Voila!
Destroys a named environment; containers and Spinner config. ## What Else?
> #### Argument: name Want to stop your containers?
>
> **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 ```shell
loom spin:stop my-project
```
These instructions are for PHPStorm. I don't know about working with other IDE's, although they Start them again?
should be fairly universal.
### Server Settings ```shell
loom spin:start my-project
```
- `File` -> `Settings` Destroy your containers?
- `PHP` -> `Servers` -> `+`
- Give your "server" a name and use the values shown below.
| Setting | Value | ```shell
|-------------------------|----------------------------------------------------------------------------------------------------------------| loom spin:down my-project
| 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 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.
- `Run` -> `Edit Configurations` Happy spinning! 🧵
- `+` -> `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"
} }