catpaw / catpaw
The catpaw project
Requires
- php: ^8.2
- ext-mbstring: *
- ext-openssl: *
- ext-pcntl: *
- ext-zlib: *
- amphp/amp: ^3.0
- amphp/byte-stream: ^2.1
- amphp/file: ^3.0
- amphp/http-client: ^5.0
- amphp/http-server: ^3.3
- amphp/http-server-form-parser: ^2.0
- amphp/parallel: ^2.0
- amphp/process: ^2.0
- amphp/websocket-server: ^4.0
- latte/latte: ^3.0
- monolog/monolog: ^3.3
- revolt/event-loop: ^1.0
- vlucas/phpdotenv: ^5.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9
- dev-master
- 3.8.5
- 3.8.4
- 3.8.3
- 3.8.2
- 3.8.1
- 3.8.0
- 3.7.7
- 3.7.6
- 3.7.5
- 3.7.4
- 3.7.3
- 3.7.2
- 3.7.1
- 3.7.0
- 3.6.0
- 3.5.6
- 3.5.5
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.4
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.1
- 3.3.0
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.12
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.4.10
- 2.4.9
- 2.4.8
- 2.4.7
- 2.4.6
- 2.4.5
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.26
- 2.3.25
- 2.3.24
- 2.3.23
- 2.3.22
- 2.3.21
- 2.3.20
- 2.3.19
- 2.3.18
- 2.3.17
- 2.3.16
- 2.3.15
- 2.3.14
- 2.3.13
- 2.3.12
- 2.3.11
- 2.3.10
- 2.3.9
- 2.3.8
- 2.3.7
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
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0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2024-09-27 09:36:32 UTC
README
Catpaw is an opinionated dependency injection library that comes with batteries included for developing asynchronous and declarative general purpose programs.
It leverages php attributes to provide declarative apis, and the amphp platform to make your program asynchronous.
Note
This project is aimed at linux distributions, some features may or not may work on Windows and/or MacOS.
Feel free to contribute fixing issues for specific platforms.
Get started
You will need at least php 8.2 and the php-mbstring
extension.
Create a new project using one of the starter templates.
- you can start from scratch
composer create-project catpaw/starter
- you can start with a web server
composer create-project catpaw/web-starter
Every application must declare a main
function in the global scope, that will be your entry point:
<?php // src/main.php use Psr\Log\LoggerInterface; function main(LoggerInterface $logger){ $logger->info("hello world"); }
After you've created your new project, you can run it using
composer dev:watch
to watch file changes (useful in development) or
composer prod:start
for production mode.
Build & Run
It is possible, but not required, to build your application into a single .phar
file using
composer prod:build
The building process can be configured inside the build.ini
file.
After building your application, you can simply run it using
php app.phar
The resulting .phar
, by default (check build.ini
), includes the following directories:
./src
./vendor
./bin
./.build-cache
(created at comptile time)
which means it's a portable binary, you just need to make sure php is installed on whatever machine you're trying to run it on.
Debugging with VSCode
-
Install xdebug
apt install php8.2-xdebug
-
Put this configuration in your
./.vscode/launch.json
file{ "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "php", "request": "launch", "program": "${workspaceRoot}/bin/start", "args": [ "--libraries='./src/lib'", "--entry='./src/main.php'" ], "cwd": "${workspaceRoot}", "runtimeArgs": [ "-dxdebug.start_with_request=yes" ], "env": { "XDEBUG_MODE": "debug,develop", "XDEBUG_CONFIG": "client_port=${port}" } }, { "name": "Listen", "type": "php", "request": "launch", "port": 9003 } ] }
-
Start debugging