Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed Aug 15, 2024
1 parent 0063303 commit 24d8f40
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 118 deletions.
33 changes: 22 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.0] - 2024-08-15

### Changed

- Name of the package from `open-southeners/laravel-helpers` to `open-southeners/extended-php` as Laravel Helpers are now located as `open-southeners/extended-laravel` ([repository here](https://github.com/open-southeners/extended-laravel)
- As package name changed we reflected the change to all namespaces, **search `OpenSoutheners/LaravelHelpers` and replace by `OpenSoutheners/ExtendedPhp`**

### Removed

- **All functions from models (moved to the extended-laravel package so replace this one with the Laravel one)**. To get this right you should **search `OpenSoutheners/LaravelHelpers/Models` and replace by `OpenSoutheners/ExtendedLaravel/Models`**

## [0.15.1] - 2024-01-22

### Fixed
Expand All @@ -29,39 +40,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- `OpenSoutheners\LaravelHelpers\Utils\parse_http_query` handle empty input with empty return
- `OpenSoutheners\LaravelHelpers\Utils\build_http_query` handle empty input with empty return
- `OpenSoutheners\ExtendedPhp\Utils\parse_http_query` handle empty input with empty return
- `OpenSoutheners\ExtendedPhp\Utils\build_http_query` handle empty input with empty return

## [0.13.1] - 2023-10-24

### Fixed

- `OpenSoutheners\LaravelHelpers\Utils\parse_http_query` with nested modifiers under parameter keys & simple values (strings)
- `OpenSoutheners\LaravelHelpers\Utils\build_http_query` with nested modifiers under parameter keys & simple values (strings)
- `OpenSoutheners\ExtendedPhp\Utils\parse_http_query` with nested modifiers under parameter keys & simple values (strings)
- `OpenSoutheners\ExtendedPhp\Utils\build_http_query` with nested modifiers under parameter keys & simple values (strings)

## [0.13.0] - 2023-10-23

### Added

- `OpenSoutheners\LaravelHelpers\Utils\parse_http_query` function for HTTP query parameters parse to multidimensional arrays
- `OpenSoutheners\LaravelHelpers\Utils\build_http_query` function for HTTP query parameters build from arrays
- `OpenSoutheners\ExtendedPhp\Utils\parse_http_query` function for HTTP query parameters parse to multidimensional arrays
- `OpenSoutheners\ExtendedPhp\Utils\build_http_query` function for HTTP query parameters build from arrays

## [0.12.0] - 2023-10-23

### Added

- `OpenSoutheners\LaravelHelpers\Strings\is_json_structure` function that covers what `is_json` does not, will also check if the json is a structure and not cases like `0`, `"0"`, `"hello world"`... which are valid in `is_json`
- `OpenSoutheners\LaravelHelpers\Strings\is_json` fallback to PHP 8.3 `json_validate` native function with deprecation warning
- `OpenSoutheners\ExtendedPhp\Strings\is_json_structure` function that covers what `is_json` does not, will also check if the json is a structure and not cases like `0`, `"0"`, `"hello world"`... which are valid in `is_json`
- `OpenSoutheners\ExtendedPhp\Strings\is_json` fallback to PHP 8.3 `json_validate` native function with deprecation warning

### Changed

- `OpenSoutheners\LaravelHelpers\Strings\is_json` now accepts any type as input value following PHP's functions
- `OpenSoutheners\ExtendedPhp\Strings\is_json` now accepts any type as input value following PHP's functions

## [0.11.0] - 2023-06-10

### Added

- `OpenSoutheners\LaravelHelpers\Enums\GetsAttributes` trait and `OpenSoutheners\LaravelHelpers\Enums\Description` attribute so enums cases can be described and used in arrays.
- `OpenSoutheners\ExtendedPhp\Enums\GetsAttributes` trait and `OpenSoutheners\ExtendedPhp\Enums\Description` attribute so enums cases can be described and used in arrays.

## [0.10.0] - 2023-02-17

Expand Down Expand Up @@ -90,7 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Enum functions now are namespaced as `OpenSoutheners\LaravelHelpers\Enums` instead of `OpenSoutheners\LaravelHelpers`
- Enum functions now are namespaced as `OpenSoutheners\ExtendedPhp\Enums` instead of `OpenSoutheners\ExtendedPhp`
- `has_case` enum function now throws exception when value is not an enum

### Added
Expand Down
1 change: 0 additions & 1 deletion docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
* [Strings helpers](strings-helpers.md)
* [Enums helpers](enums-helpers.md)
* [Classes helpers](classes-helpers.md)
* [Models helpers](models-helpers.md)
18 changes: 9 additions & 9 deletions docs/classes-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gets the namespace from class or object.
```php
$class = App\Http\Controllers\MyController::class;

\OpenSoutheners\LaravelHelpers\Classes\class_namespace($class);
\OpenSoutheners\ExtendedPhp\Classes\class_namespace($class);
// 'App\Http\Controllers'
```

Expand All @@ -22,7 +22,7 @@ Similarly than PHP's [`class_implements`](https://www.php.net/manual/en/function
```php
class MyClass implements MyInterface {}

\OpenSoutheners\LaravelHelpers\Classes\class_implement(MyClass::class, MyInterface::class);
\OpenSoutheners\ExtendedPhp\Classes\class_implement(MyClass::class, MyInterface::class);
// true
```

Expand All @@ -33,7 +33,7 @@ Similarly than PHP's [`class_uses`](https://www.php.net/manual/en/function.class
```php
class MyClass implements MyInterface {}

\OpenSoutheners\LaravelHelpers\Classes\class_use(MyClass::class, MyTrait::class);
\OpenSoutheners\ExtendedPhp\Classes\class_use(MyClass::class, MyTrait::class);
// false
```

Expand All @@ -52,17 +52,17 @@ class MyClass implements MyInterface
{
return "greetings {$name}!";
}

public function myMethod(string $name)
{
return "hello {$name}!";
}
}

\OpenSoutheners\LaravelHelpers\Classes\call(MyClass::class, 'myStaticMethod', ['user'], true);
\OpenSoutheners\ExtendedPhp\Classes\call(MyClass::class, 'myStaticMethod', ['user'], true);
// 'greetings user!'

\OpenSoutheners\LaravelHelpers\Classes\call(MyClass::class, 'myMethod', ['world']);
\OpenSoutheners\ExtendedPhp\Classes\call(MyClass::class, 'myMethod', ['world']);
// 'hello world!'
```

Expand All @@ -79,7 +79,7 @@ class MyClass implements MyInterface
}
}

\OpenSoutheners\LaravelHelpers\Classes\call_static(MyClass::class, 'myStaticMethod', ['user']);
\OpenSoutheners\ExtendedPhp\Classes\call_static(MyClass::class, 'myStaticMethod', ['user']);
// 'greetings user!'
```

Expand All @@ -91,9 +91,9 @@ Gets class string from object or class. Similarly to PHP's [`get_class`](https:/
$class = App\Http\Controllers\MyController::class;
$classInstance = new $class;

\OpenSoutheners\LaravelHelpers\Classes\class_from($class);
\OpenSoutheners\ExtendedPhp\Classes\class_from($class);
// 'App\Http\Controllers\MyController'

\OpenSoutheners\LaravelHelpers\Classes\class_from($classInstance);
\OpenSoutheners\ExtendedPhp\Classes\class_from($classInstance);
// 'App\Http\Controllers\MyController'
```
40 changes: 20 additions & 20 deletions docs/enums-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Check if object or class is a PHP enum.
enum MyEnum
{
case First;

case Second;

case Third;
}

\OpenSoutheners\LaravelHelpers\Enums\is_enum(MyEnum::class); // true
\OpenSoutheners\ExtendedPhp\Enums\is_enum(MyEnum::class); // true
```

## enum\_is\_backed
Expand All @@ -29,13 +29,13 @@ Check if object or class is a backed PHP enum.
enum MyEnum
{
case First;

case Second;

case Third;
}

\OpenSoutheners\LaravelHelpers\Enums\enum_is_backed(MyEnum::class); // false
\OpenSoutheners\ExtendedPhp\Enums\enum_is_backed(MyEnum::class); // false
```

## has\_case
Expand All @@ -46,13 +46,13 @@ Check if object or class is a PHP enum that has the specified case.
enum MyEnum
{
case First;

case Second;

case Third;
}

\OpenSoutheners\LaravelHelpers\Enums\has_case(MyEnum::class, 'First'); // true
\OpenSoutheners\ExtendedPhp\Enums\has_case(MyEnum::class, 'First'); // true
```

## get\_enum\_class
Expand All @@ -63,13 +63,13 @@ Get class string from enum object.
enum MyEnum
{
case First;

case Second;

case Third;
}

\OpenSoutheners\LaravelHelpers\Enums\get_enum_class(MyEnum::First); // 'MyEnum'
\OpenSoutheners\ExtendedPhp\Enums\get_enum_class(MyEnum::First); // 'MyEnum'
```

## enum\_to\_array
Expand All @@ -80,13 +80,13 @@ Converts PHP enum object or class into an array. In case of a backed enum it wil
enum MyEnum
{
case First;

case Second;

case Third;
}

\OpenSoutheners\LaravelHelpers\Enums\enum_to_array(MyEnum::class);
\OpenSoutheners\ExtendedPhp\Enums\enum_to_array(MyEnum::class);
// ['First', 'Second', 'Third']
```

Expand All @@ -98,13 +98,13 @@ Gets array of values from PHP backed enum.
enum MyBackedEnum: string
{
case First = 'one';

case Second = 'two';

case Third = 'three';
}

\OpenSoutheners\LaravelHelpers\Enums\enum_values(MyBackedEnum::class);
\OpenSoutheners\ExtendedPhp\Enums\enum_values(MyBackedEnum::class);
// ['one', 'two', 'three']
```

Expand All @@ -121,8 +121,8 @@ This trait will add some functions to the PHP enums so they can be converted to
This is a PHP attribute to be used in those enum cases to be used along with `GetsAttribute` trait:

```php
use OpenSoutheners\LaravelHelpers\Enums\Description;
use OpenSoutheners\LaravelHelpers\Enums\GetsAttributes;
use OpenSoutheners\ExtendedPhp\Enums\Description;
use OpenSoutheners\ExtendedPhp\Enums\GetsAttributes;

enum MyBackedEnum: string
{
Expand Down
74 changes: 0 additions & 74 deletions docs/models-helpers.md

This file was deleted.

6 changes: 3 additions & 3 deletions docs/strings-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Check if a variable is a valid json string.
```php
$json = '{}';

\OpenSoutheners\LaravelHelpers\Strings\is_json($json); // true
\OpenSoutheners\ExtendedPhp\Strings\is_json($json); // true
```

## is\_json\_structure
Expand All @@ -25,7 +25,7 @@ Similarly than `is_json` function but this one also checks if the data inside th
```php
$json = '1';

\OpenSoutheners\LaravelHelpers\Strings\is_json_structure($json); // false
\OpenSoutheners\ExtendedPhp\Strings\is_json_structure($json); // false
```

## get\_email\_domain
Expand All @@ -35,5 +35,5 @@ Get domain part from email address:
```php
$email = '[email protected]';

\OpenSoutheners\LaravelHelpers\Strings\get_email_domain($email); // 'mydomain.com'
\OpenSoutheners\ExtendedPhp\Strings\get_email_domain($email); // 'mydomain.com'
```

0 comments on commit 24d8f40

Please sign in to comment.