-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from codelayerhq/docs
Initial readme
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2020 codelayer GmbH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# PHP Bubblewrap | ||
|
||
![](https://github.com/codelayerhq/bubblewrap-php/workflows/PHP%20Composer/badge.svg) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
![Packagist Version](https://img.shields.io/packagist/v/codelayer/bubblewrap) | ||
|
||
A PHP wrapper class for the [bubblewrap](https://github.com/containers/bubblewrap) cli tool. | ||
Can be used to execute external commands like imagemagick or ghostscript in a separated environment | ||
as a protection against possible security issues. | ||
|
||
## Installation | ||
|
||
The package can be installed using composer: | ||
|
||
``` | ||
$ composer require codelayer/bubblewrap | ||
``` | ||
|
||
## Usage | ||
|
||
At the moment most commands that don't take a file descriptor as argument are implemented. | ||
This snippet shows how the example from the bubblewrap readme looks in PHP: | ||
|
||
```php | ||
$bwrap = new \Codelayer\Bubblewrap\Bubblewrap(); | ||
|
||
$bwrap | ||
->readOnlyBind('/usr') // If src equals dest only one parameter is required for bind commands | ||
->symlink('usr/lib64', '/lib') | ||
->proc() // /proc is used as default location for procfs | ||
->dev() // /dev is used as default location for devtmpfs | ||
->unsharePid() | ||
->exec(['bash']); | ||
``` | ||
|
||
Exec returns a [Symfony Process](https://symfony.com/doc/current/components/process.html) object. | ||
|
||
## Additional methods | ||
|
||
Two additional methods are available to modify how bubblewrap is called: | ||
|
||
* `setBinary($binary)` sets the location of the bwrap binary | ||
* `clearEnv()` prepends `env -i` to the bwrap calls and unsets all environment variables | ||
* `getCommand($cmd)` show the full command that `exec($cmd)` would execute | ||
|
||
## License | ||
|
||
This package is licensed under the MIT License. | ||
For more information see the [LICENSE file](./LICENSE). | ||
|
||
## About us | ||
|
||
codelayer is a software company from Karlsruhe, Germany which specializes in web application development. | ||
For more information about codelayer, visit our website at [codelayer.de](https://codelayer.de). |