11 months ago

Would like to get feedback in my first package

Posted 11 months ago by Squire

Hello guys. So I've been into programing for 1 and a half year now and I've been spending the last 7 months learning Laravel. I wanted to do something different aside from the normal backend services for applications so I decided to try with a package.

I read a couple of tutorials regarding the folder structure and what I had to do to made it available in composer and all that stuff. But anyways, these are my biggest concerns right now:

  1. I'm developing it to be used only with Laravel, but I've read a lot of threads where people talk about packages should be general use, not framework orientated. What should be the best approach to achieve this?

  2. All the logic is inside one single class. I've been thinking that I can separate some stuff to improve the readability and scalability, but that would make me loss my one single facade feature. What do you recommend me?

  3. I've read that one shouldn't enforce developers to use facades but give them the option to choice between that or dependency injection. How can I make sure that my package can work thorugh dependency injection too?

  4. And this one may sound stupid but I had a tough time trying to choose the name of my logic class. First off, I placed it inside a "Helpers" class and then named it "UrlShortenerHelper" (I don't remember why) but then today I named the whole thing to "Services/UrlShortenerService" because it made more sense to me. Is there any naming convention for this kind of stuff? I'm very used to laravel convention for classic backend services naming convention, like controllers have the name of the resource in singular followed by the controller name and stuff like that.

Thank you for taking the time of read my code. This is the repository: https://github.com/cedaesca/urlshortener

Please sign in or create an account to participate in this conversation.