Skip to content

Commit

Permalink
GITBOOK-9: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaEstes authored and gitbook-bot committed Sep 12, 2024
1 parent 4ad8b79 commit a2a07e3
Show file tree
Hide file tree
Showing 24 changed files with 471 additions and 272 deletions.
Binary file added docs/.gitbook/assets/top-rocker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 25 additions & 30 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
---
title: Home
description: Sons of PHP has many libraries and projects for developers.
cover: .gitbook/assets/top-rocker.png
coverY: 0
layout:
cover:
visible: true
size: full
title:
visible: true
description:
visible: true
tableOfContents:
visible: true
outline:
visible: true
pagination:
visible: true
---

<div align="center">
<img src="https://raw.githubusercontent.com/SonsOfPHP/.github/main/assets/top-rocker.png" />
</div>
<hr>
# 🏠 Home

# Welcome to the Sons of PHP
## Welcome to the Sons of PHP

## Reporting Issues
### Reporting Issues

Please use the main [Sons of PHP Repository][mother-repo] to report any [issues][issues] that
you find.
Please use the main [Sons of PHP Repository](https://github.com/SonsOfPHP/sonsofphp) to report any [issues](https://github.com/SonsOfPHP/sonsofphp/issues) that you find.

If you find any issues with the documentation, please submit issues in the
dedicated [Documentation Repository][docs-repo].
### Contributing

## Contributing
Please submit [Pull Requests](https://github.com/SonsOfPHP/sonsofphp/pulls) to the main [Sons of PHP Repository](https://github.com/SonsOfPHP/sonsofphp).

Please submit [Pull Requests][pull-requests] to the main [Sons of PHP Repository][mother-repo].
### Getting Help

If you would like to help with documentation, please use the dedicated
[Documentation Repository][docs-repo] to submit pull requests.

## Getting Help

Please visit the [Sons of PHP Organization Discussions][discussions] section to
ask questions and get more help.

## Hanging Out

Drop by the [Discord Server][discord].

[discussions]: https://github.com/orgs/SonsOfPHP/discussions
[mother-repo]: https://github.com/SonsOfPHP/sonsofphp
[pull-requests]: https://github.com/SonsOfPHP/sonsofphp/pulls
[issues]: https://github.com/SonsOfPHP/sonsofphp/issues
[docs-repo]: https://github.com/SonsOfPHP/sonsofphp
[discord]: https://discord.gg/sdVxNhFqND
Please visit the [Sons of PHP Organization Discussions](https://github.com/orgs/SonsOfPHP/discussions) section to ask questions and get more help.
27 changes: 17 additions & 10 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Table of contents

* [Home](README.md)
* [🏠 Home](README.md)
* [Contributor Covenant Code of Conduct](code-of-conduct.md)
* [Getting Help](getting-help.md)
* [Reporting Issues](reporting-issues.md)
* [Security Policy](security.md)

## Bard
## 🪈 Bard

* [Bard Overview](bard/bard-overview.md)
* [Overview](bard/overview.md)
* [Commands](bard/commands.md)

## Components
## 📦 Components

* [Components Overview](components/index.md)
* [Assert](components/assert.md)
* [Cache](components/cache.md)
* [Cache](components/cache/README.md)
* [Adapters](components/cache/adapters.md)
* [Clock](components/clock.md)
* [Container](components/container.md)
* [Cookie](components/cookie.md)
Expand All @@ -37,13 +38,19 @@
* [Http Message](components/http-message.md)
* [JSON](components/json.md)
* [Link](components/link.md)
* [Logger](components/logger.md)
* [Mailer](components/mailer.md)
* [Logger](components/logger/README.md)
* [Handlers](components/logger/handlers.md)
* [Enrichers](components/logger/enrichers.md)
* [Filters](components/logger/filters.md)
* [Formatters](components/logger/formatters.md)
* [Mailer](components/mailer/README.md)
* [Transports](components/mailer/transports.md)
* [Money](components/money/README.md)
* [Currency Providers](components/money/currency-providers.md)
* [Operators](components/money/operators.md)
* [Queries](components/money/queries.md)
* [Pager](components/pager.md)
* [Pager](components/pager/README.md)
* [Adapters](components/pager/adapters.md)
* [State Machine](components/state-machine.md)
* [Version](components/version.md)

Expand All @@ -58,7 +65,7 @@
* [Pager](contracts/pager.md)
* [State Machine](contracts/state-machine.md)

## Contributing
## 💁 Contributing

* [Contributing Overview](contributing/index.md)
* [Contributing Code](contributing/code.md)
Expand Down
45 changes: 45 additions & 0 deletions docs/bard/commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Commands

## init

Initialize a new mono repository.

```shell
bard init
```

## add

Add a new package to bard.

```sh
bard add <path> <repository>
```

## merge

This command will merge all packages into the root `composer.json` file.

```sh
bard merge [<package>]
```

## push

Pushes code to their respective repositories.

```sh
bard push [<package>]
```

## release

Creates a new release. This command will update all the files that need to be updated, tag, and push the release out.

```sh
bard release <release>
```

{% hint style="success" %}
You can use `major`, `minor`, or `patch` as the `<release>` argument instead of specifying the exact version you want to release.
{% endhint %}
File renamed without changes.
66 changes: 66 additions & 0 deletions docs/components/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,74 @@
title: Assert
---

# Assert

## Installation

```shell
composer require sonsofphp/assert
```

## Usage

```php
<?php

use SonsOfPHP\Component\Assert\Assert;
use SonsOfPHP\Component\Assert\InvalidArgumentException;

$data = 'test';
Assert::string($data);

// @throws InvalidArgumentException
Assert::int($data);

// Disable exceptions
Assert::disable();

// @return bool
Assert::int($data);

// Re-enable exceptions
Assert::enable();
```

## Assertions

```php
Assert::array($value);
Assert::bool($value);
Assert::callable($value);
Assert::empty($value);
Assert::eq($value, $value2);
Assert::false($value);
Assert::float($value);
Assert::int($value);
Assert::null($value);
Assert::numeric($value);
Assert::object($value);
Assert::resource($value);
Assert::same($value, $value2);
Assert::scalar($value);
Assert::string($value);
Assert::true($value);
```

## Magic Assertions

```php
// "all"
// Throws exception if any value in $values is not the correct type
Assert::allString($values);
Assert::allString(['one', 'two', 3]); // Throws Exception

// "not"
// Throws exception if $value is the type
Assert::notString($value);
Assert::notString('opps'); // Throws Exception

// "nullOr"
// Throws exception if $value is not null or not type
Assert::nullOrString($value);
Assert::nullOrString(42); // Throws Exception
```
6 changes: 2 additions & 4 deletions docs/components/cache.md → docs/components/cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Cache - Overview
---

Used for cache stuff
# Cache

## Installation

Expand Down Expand Up @@ -59,8 +59,6 @@ $pool = new ChainAdapter([
]);
```

The `ChainAdapter` will read from all pools and return the first result it
finds. So in the above example, if the cache item is not found in
`ArrayAdapter`, it will look for it in the `ApcuAdapter` pool.
The `ChainAdapter` will read from all pools and return the first result it finds. So in the above example, if the cache item is not found in `ArrayAdapter`, it will look for it in the `ApcuAdapter` pool.

The `ChainAdapter` will also write to and delete from all pools.
18 changes: 18 additions & 0 deletions docs/components/cache/adapters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Adapters

## ApcuAdapter



## ArrayAdapter



## ChainAdapter



## NullAdapter



7 changes: 4 additions & 3 deletions docs/components/container.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
---
title: Container
description: PSR-11 Container
---

This is a very simple lightweight PSR-11 Container implementation.
# Container

## Installation
### Installation

```shell
composer require sonsofphp/container
```

## Usage
### Usage

```php
<?php
Expand Down
17 changes: 0 additions & 17 deletions docs/components/index.md

This file was deleted.

13 changes: 13 additions & 0 deletions docs/components/link.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
---
title: Link
description: 'PSR-13: Link'
---

# Link

## Installation

```shell
composer require sonsofphp/link
```

## Usage

```php
<?php

use SonsOfPHP\Component\Link\Link;

$link = new Link('https://docs.sonsofphp.com');
```
13 changes: 7 additions & 6 deletions docs/components/logger.md → docs/components/logger/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
---
title: Logger (PSR-3 Compatible)
description: PSR-3 Logger
---

# Logger

Simple yet powerful PSR-3 Logger.

### Installation
## Installation

```shell
composer require sonsofphp/logger
```

### Usage
## Usage

Simple Usage Example

Expand Down Expand Up @@ -54,20 +55,20 @@ $handler->setFilter(new LogLevelFilter(Level::Alert));
$logger->addHandler($handler);
```

#### Handlers
## Handlers

Handlers are responsible for "handling" the log message. The handler will send the log message where it's been configured to. Out of the box, it supports a few different handlers.

#### Enrichers
## Enrichers

Enrichers will add extra context to the log message. This could be the git hash or memory usage, or anything else you want.

Enrichers are also used to modify context values in case someone adds sensitive values in there.

#### Filters
## Filters

Filters can be used to determine it the log message should be handled. Custom filters could be specific to an HTTP Request so that ONLY requests matching a specific path would be handled. You could also make a custom filter to log only authenticated users

#### Formatters
## Formatters

Formatters are used by Handlers to format the message that needs to be logged.
Loading

0 comments on commit a2a07e3

Please sign in to comment.