Skip to content

Commit

Permalink
Document changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arokettu committed Jan 3, 2024
1 parent e6f223f commit ac150a3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
25 changes: 19 additions & 6 deletions docs/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@ Upgrade Notes

.. highlight:: php

Upgrade from 2.x
================
3.x to 4.0
==========

* Object and methods no longer accept empty string for a completely random monster.
Pass a random string explicitly::

<?php

use function Arokettu\MonsterID\build_monster;

// before 4.0
$randomMonster = build_monster();
// 4.0 and later
$randomMonster = build_monster(random_bytes(8));

2.x to 3.0
==========

* The package was renamed to ``arokettu/monsterid``

Expand All @@ -23,8 +38,6 @@ Upgrade from 2.x

use function Arokettu\MonsterID\build_monster;

require 'vendor/autoload.php';

build_monster('my@email', rngFactory: new DefaultV2Factory());

// or
Expand All @@ -33,8 +46,8 @@ Upgrade from 2.x

* ``build()`` method was removed

Upgrade from 1.x
================
1.x to 2.0
==========

* Expect different images to be generated

Expand Down
19 changes: 19 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ Export GD object::
imageavif($gd);
imagedestroy($gd); // it's your responsibility to destroy the resource (PHP < 8.0)

Get a response object::

<?php

use Psr\Http\Message\ResponseInterface;

use function Arokettu\MonsterID\build_monster_response;

class Controller
{
public function action(): ResponseInterface
{
return build_monster_response('email@example.com', 150);
}
}

Monster object
--------------

Expand All @@ -71,6 +87,9 @@ Monster object
header('Content-type: image/avif');
imageavif($monster->getGdImage());

// response
$response = $monster->getResponse();

Random sequences
================

Expand Down

0 comments on commit ac150a3

Please sign in to comment.