Skip to content

Commit fa89734

Browse files
committed
chore: remove console and framework
1 parent e41c8d0 commit fa89734

File tree

10 files changed

+237
-642
lines changed

10 files changed

+237
-642
lines changed

README.md

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ script.php
2121
require_once './vendor/autoload.php';
2222

2323
use Utopia\CLI\CLI;
24-
use Utopia\CLI\Console;
24+
use Utopia\Console;
2525
use Utopia\CLI\Adapters\Generic;
26-
use Utopia\Http\Validator\Wildcard;
26+
use Utopia\Validator\Wildcard;
2727

2828
$cli = new CLI(new Generic());
2929

@@ -52,8 +52,8 @@ There are three types of hooks, init hooks, shutdown hooks and error hooks. Init
5252
require_once __DIR__ . '/../../vendor/autoload.php';
5353

5454
use Utopia\CLI\CLI;
55-
use Utopia\CLI\Console;
56-
use Utopia\Http\Validator\Wildcard;
55+
use Utopia\Console;
56+
use Utopia\Validator\Wildcard;
5757

5858
CLI::setResource('res1', function() {
5959
return 'resource 1';
@@ -83,72 +83,6 @@ $cli
8383
$cli->run();
8484
```
8585

86-
### Log Messages
87-
88-
```php
89-
Console::log('Plain Log'); // stdout
90-
```
91-
92-
```php
93-
Console::success('Green log message'); // stdout
94-
```
95-
96-
```php
97-
Console::info('Blue log message'); // stdout
98-
```
99-
100-
```php
101-
Console::warning('Yellow log message'); // stderr
102-
```
103-
104-
```php
105-
Console::error('Red log message'); // stderr
106-
```
107-
108-
### Execute Commands
109-
110-
Function returns exit code (0 - OK, >0 - error) and writes stdout, stderr to reference variables. The timeout variable allows you to limit the number of seconds the command can run.
111-
112-
```php
113-
$stdout = '';
114-
$stderr = '';
115-
$stdin = '';
116-
$timeout = 3; // seconds
117-
$code = Console::execute('>&1 echo "success"', $stdin, $stdout, $stderr, $timeout);
118-
119-
echo $code; // 0
120-
echo $stdout; // 'success'
121-
echo $stderr; // ''
122-
```
123-
124-
```php
125-
$stdout = '';
126-
$stderr = '';
127-
$stdin = '';
128-
$timeout = 3; // seconds
129-
$code = Console::execute('>&2 echo "error"', $stdin, $stdout, $stderr, $timeout);
130-
131-
echo $code; // 0
132-
echo $stdout; // ''
133-
echo $stderr; // 'error'
134-
```
135-
136-
### Create a Daemon
137-
138-
You can use the `Console::loop` command to create your PHP daemon. The `loop` method already handles CPU consumption using a configurable sleep function and calls the PHP garbage collector every 5 minutes.
139-
140-
```php
141-
<?php
142-
143-
use Utopia\CLI\Console;
144-
145-
include './vendor/autoload.php';
146-
147-
Console::loop(function() {
148-
echo "Hello World\n";
149-
}, 1 /* 1 second */);
150-
```
151-
15286
## System Requirements
15387

15488
Utopia Framework requires PHP 7.4 or later. We recommend using the latest PHP version whenever possible.

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
"format": "vendor/bin/pint"
1212
},
1313
"autoload": {
14-
"psr-4": {"Utopia\\CLI\\": "src/CLI"}
14+
"psr-4": {
15+
"Utopia\\CLI\\": "src/CLI"
16+
}
1517
},
1618
"require": {
1719
"php": ">=7.4",
18-
"utopia-php/framework": "1.0.*",
19-
"utopia-php/di": "0.1.*"
20+
"utopia-php/servers": "0.2.*"
2021
},
2122
"require-dev": {
23+
"utopia-php/console": "0.0.*",
2224
"phpunit/phpunit": "^9.3",
2325
"squizlabs/php_codesniffer": "^3.6",
2426
"phpstan/phpstan": "^1.10",
2527
"laravel/pint": "1.2.*",
2628
"swoole/ide-helper": "4.8.8"
2729
},
2830
"minimum-stability": "dev"
29-
30-
3131
}

0 commit comments

Comments
 (0)