Looks cool and fun. Code seems clean as well. Unsure why you wrap shuffle though
One idea. Load the facts from thanslstions, allowing them to be translated to other languages. Maybe I would pr Danish. Would be fun to use in prototypes :)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I created a simple package https://github.com/James-N-M/chuck-norris-ipsum after watching the first part of marcel pociot' package development course. Just wondering if anyone has any tips for features, cleaner code etc etc. It was a very simple project to just help solidify some of the concepts i learned. Thanks again
When your function has no return, you can use the void return type hint
public function __construct(Client $client = null): void
{
$this->client = $client ?: new Client();
}
Also if your method returns $this you can use return type hint of self e.g.
public function jokes(int $count = 2): self
{
$this->ipsum .= $this->jokesIpsum->jokes($count);
return $this;
}
This will just aid your IDE along.
Instead of const API_ENDPOINT = 'http://api.icndb.com/jokes'; you could use an environment variable or config. See Laravel's documentation here : https://laravel.com/docs/5.8/packages#configuration this way you can publish your configuration for the package and the endpoint could be modified per installation
Please or to participate in this conversation.