You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: documentation/advanced/logging.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,8 @@
2
2
3
3
If you want to trace everything that is done on your operating system you can use the logger decorator that will automatically write to your log file (almost) all operations.
4
4
5
-
> [!NOTE]
6
-
> data and actions done on a socket are not logged as well as processes output to prevent logging too much data (at least for now).
5
+
!!! note ""
6
+
Data and actions done on a socket are not logged as well as processes output to prevent logging too much data (at least for now).
7
7
8
8
```php
9
9
use Innmind\OperatingSystem\OperatingSystem\Logger;
This library is here to help abstract all the operations that involve the operating system the PHP code run on.
@@ -8,8 +14,8 @@ The other advantage to use higher level abstractions is to enable end user to bu
8
14
9
15
For concrete examples have a look at the use cases available in the sidebar.
10
16
11
-
> [!NOTE]
12
-
> this library is a small overlay on top of a set of individual libraries that contain the concrete abstractions. So you can start using only a subset of abstractions in your code as a starting point.
17
+
!!! note ""
18
+
This library is a small overlay on top of a set of individual libraries that contain the concrete abstractions. So you can start using only a subset of abstractions in your code as a starting point.
13
19
14
20
## Installation
15
21
@@ -27,21 +33,5 @@ $os = Factory::build();
27
33
28
34
There's nothing more to add to start using this abstraction. Head toward the use cases to understand all the things you can do with it.
29
35
30
-
> [!WARNING]
31
-
> This library doesn't work on windows environments.
32
-
33
-
## Use cases
34
-
35
-
-[Manipulating time](use_cases/time.md)
36
-
-[Filesystem](use_cases/filesystem.md)
37
-
-[HTTP Client](use_cases/http.md)
38
-
-[Processes](use_cases/processes.md)
39
-
-[Inter Process Communication](use_cases/ipc.md)
40
-
-[Socket communication](use_cases/socket.md)
41
-
-[Handling process signals](use_cases/signals.md)
42
-
-[SQL connection](use_cases/sql.md)
43
-
44
-
## Advanced usage
45
-
46
-
-[Logging all operations](advanced/logging.md)
47
-
-[Extensions](advanced/extensions.md)
36
+
!!! warning ""
37
+
This library doesn't work on windows environments.
Here it will run phpunit tests every time the `src/` folder changes. Concrete examples of this pattern can be found in [`innmind/lab-station`](https://github.com/Innmind/LabStation/blob/develop/src/Agent/WatchSources.php#L38) to run a suite of tools when sources change.
131
142
132
143
This operation is a bit like an `array_reduce` as you can keep a state record between each calls of the callable via the first argument (here `0`, but it can be anything) and the argument of your callable will be the previous value returned by `$continuation->continue()`.
133
144
134
-
> [!WARNING]
135
-
> since there is no builtin way to watch for changes in a directory it checks the directory every second, so use it with care. Watching an individual file is a bit safer as it uses the `tail` command so there is no `sleep()` used.
145
+
!!! warning ""
146
+
Since there is no builtin way to watch for changes in a directory it checks the directory every second, so use it with care. Watching an individual file is a bit safer as it uses the `tail` command so there is no `sleep()` used.
All elements of a request/response call is built using objects to enforce correctness of the formatted messages.
30
30
31
-
> [!NOTE]
32
-
> since request and responses messages can be viewed either from a client or a server the model is abstracted in the standalone [`innmind/http` library](https://github.com/innmind/http).
31
+
!!! note ""
32
+
Since request and responses messages can be viewed either from a client or a server the model is abstracted in the standalone [`innmind/http` library](https://github.com/innmind/http).
33
33
34
34
## Resiliency in a distributed system
35
35
@@ -63,5 +63,5 @@ $response = $http($request);
63
63
$response = $http($request);
64
64
```
65
65
66
-
> [!NOTE]
67
-
> the circuit breaker works on host per host basis meaning if `server1.com` fails then calls to `server2.com` will still be sent.
66
+
!!! note ""
67
+
The circuit breaker works on host per host basis meaning if `server1.com` fails then calls to `server2.com` will still be sent.
Copy file name to clipboardexpand all lines: documentation/use_cases/ipc.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,8 @@ To communicate between processes on a same system there is 2 approaches: sharing
4
4
5
5
The later is the safest of the two (but not exempt of problems) and you will find here the building blocks to communicate via a socket.
6
6
7
-
> [!TIP]
8
-
> the adage `share state through messages and not messages through state` is a pillar of the [actor model](https://en.wikipedia.org/wiki/Actor_model) and [initially of object oriented programming](https://www.youtube.com/watch?v=7erJ1DV_Tlo).
7
+
!!! tip ""
8
+
The adage `share state through messages and not messages through state` is a pillar of the [actor model](https://en.wikipedia.org/wiki/Actor_model) and [initially of object oriented programming](https://www.youtube.com/watch?v=7erJ1DV_Tlo).
9
9
10
10
```php
11
11
# process acting as a server
@@ -61,5 +61,5 @@ echo $client
61
61
62
62
In the case the server is started first then the client would print `Hello`.
63
63
64
-
> [!WARNING]
65
-
> this is a very rough implementation of communication between processes. **DO NOT** use this simple implementation in your code, instead use a higher level API such as [`innmind/ipc`](https://github.com/innmind/ipc).
64
+
!!! warning ""
65
+
This is a very rough implementation of communication between processes. **DO NOT** use this simple implementation in your code, instead use a higher level API such as [`innmind/ipc`](https://github.com/innmind/ipc).
$os->process()->signals()->listen(Signal::terminate, function() use (&$signaled) {
29
-
$signaled = false;
30
-
});
31
+
$os
32
+
->process()
33
+
->signals()
34
+
->listen(Signal::terminate, function() use (&$signaled) {
35
+
$signaled = false;
36
+
});
31
37
32
38
$receivedData = $client
33
39
->timeoutAfter(ElapsedPeriod::of(1_000))
@@ -52,8 +58,8 @@ $client->unwrap()->close();
52
58
53
59
When the process receive the `SIGTERM` signal it will be paused then the anonymous function will be called and the process will then be resumed.
54
60
55
-
> [!NOTE]
56
-
> signal handling is already performed when using [`innmind/ipc`](https://github.com/innmind/ipc) or [`innmind/amqp`](https://github.com/innmind/amqp) so you don't have to think about it.
61
+
!!! note ""
62
+
Signal handling is already performed when using [`innmind/ipc`](https://github.com/innmind/ipc) or [`innmind/amqp`](https://github.com/innmind/amqp) so you don't have to think about it.
Copy file name to clipboardexpand all lines: documentation/use_cases/time.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,8 @@
2
2
3
3
Directly accessing time in a PHP code is straightforward (either via `DateTime` or time functions) but it prevents you to build testable code or require to use some hard to understand hacks. Instead it is simpler to think of time as another dependency that you need to inject in your code, thus easier to change the implementation when testing.
4
4
5
-
> [!TIP]
6
-
> for a more in length presentation of why directly accessing time is problematic you can watch this [talk](https://www.youtube.com/watch?v=T_I6HhP9-6w) (in french).
5
+
??? tip
6
+
For a more in length presentation of why directly accessing time is problematic you can watch this [talk](https://www.youtube.com/watch?v=T_I6HhP9-6w) (in french).
0 commit comments