novuhq / novu-php

PHP SDK for Novu - The open-source notification infrastructure for engineers. :rocket:
https://docs.novu.co/sdks/php
MIT License
85 stars 23 forks source link

Novu Package Not Found #1

Closed hayjay closed 1 year ago

hayjay commented 1 year ago

What is this issue about ?

After requiring this package in a project (a php project and in a php framework), instantiating the Novu class as mentioned in the README file throws an error saying that the Novu\SDK\Novu page isn't found.

How can it be reproduced

Step 1: require this package in a php project - composer require unicodeveloper/novu as stated in the README Step 2: Import the name space in a php file use Novu\SDK\Novu; Step 3: Instantiate the Novu class $novu = new Novu(<INSERT_API_KEY_HERE>);

Expected error message in a PHP project (without framework): Fatal error: Uncaught Error: Class "Novu\SDK\Novu" not found

Useful files/attachments

Screenshot 2023-01-09 at 19 19 15

Investigation/Possible Solution

Screenshot 2023-01-09 at 19 30 13

From the above screenshot (In the composer.json file) where the project src directory is been autoloaded i.e in the psr-4 autoload object, there seems to be a wrong-spelling of the alias names "Nova\\SDK\\" where the src directory is aliased, I would assume that it's supposed to be "Novu\\SDK\\" and not"Nova\SDK\" - key difference here seems to be Nova and Novu.

For me, I think this is just a mistake since the project classes and actions uses a different namespace as seen below:

Screenshot 2023-01-09 at 19 34 06 Screenshot 2023-01-09 at 19 34 21

The namespaces used are incorrect since the alias in the composer.json has a different spelling with the class namespaces as seen above.

Please let me know if I am wrong or if everything is done as expected and I will try to continue investigating what might have gone wrong with my installation.

Thanks for the good work!

unicodeveloper commented 1 year ago

@hayjay checking this now. Thanks for bringing this to my attention.

unicodeveloper commented 1 year ago

@hayjay This has been fixed now. Please uninstall the package and install again. Thanks so much for catching this. This was a huge oversight.

hayjay commented 1 year ago

@unicodeveloper Thanks very much, I have re-tested and it works perfectly now.

unicodeveloper commented 1 year ago

Awesome. I'm glad it works perfectly now.

hayjay commented 1 year ago

No problem, thanks for the support too.