- This topic has 8 replies, 1 voice, and was last updated 1 day, 22 hours ago by justlasse.
- January 14, 2021 at 1:41 am #5756KeironLoweParticipant
I know WordPress isn’t too popular around here, and for good reason, but I wanted to do what I can to try make it a bit better. So I built [Posty](https://github.com/KeironLowe/posty), which provides a fluent API for creating custom post types and managing its columns. Any of you who have built WordPress sites know that there is quite a bit of code required to create a CPT and even more if you want to manage the columns for it.
I’ve tried to reduce that down and it’s it’s most simplest form, it’s now as simple as `PostyPosty::make(‘Product’, ‘Products’)->register();`.
Let me know what you think, like I said it’s my first time publishing an open source package so happy for any critique.January 14, 2021 at 1:41 am #5757Flibbertygibbety22Guest
Nice! Looks really well written – clear code, good documentation, well-written tests. Some suggestions, from somebody that doesn’t know much about WordPress:
– I don’t know much about the use case, perhaps the README could explain a bit more about when I would want to use this library.
– WordPress isn’t mentioned in the `composer.json` as a dependency. Is that right?
– With libraries, I try to keep dependencies to an absolute mininmum, even in dev, to minimise the risk of a blacklisted dependency cascading throughout my application. It feels like `brain/monkey` doesn’t add much, just a bit of syntactic sugar, so I’d probably just write my mocks out the long way and remove the dependency.
– Could `PostySupportRepository` be an abstract class?
– I’d remove the `.idea` from the `.gitignore` file, and use that in my personal global `.gitignore` instead.
Good work on releasing it, I’m sure it will be really useful for some people.January 14, 2021 at 1:41 am #5758michaelbiberichGuest
Well done. Two small things I’ve noticed:
* [Github Flavored Markdown](https://github.github.com/gfm/#example-112) supports PHP syntax highlighting (eg to use in your [README.md](https://github.com/KeironLowe/posty/commit/8a660d213719a8b9c5bc59e1c3dea3252dac1e1f#diff-04c6e90faac2675aa89e2176d2eec7d8R18)). [Example](https://github.com/michaelbiberich/turbolinks-location-middleware/commit/4b9dd9f98ad26d0450e5d04c7f95d8bd4fcf6048#diff-04c6e90faac2675aa89e2176d2eec7d8R61).
* Is there a specific reason to use the `@var` annotations when the [properties are already typed](https://github.com/KeironLowe/posty/blob/master/src/Posty.php#L14) identically?
Edit: Fixed some typos.January 14, 2021 at 1:41 am #5759devmorGuest
Though I lack the sanity protections for it, I wholeheartedly support any efforts to bring modern development to WordPress. This Looks like an amazingly built library and I hope other WP developers use it as inspiration.January 14, 2021 at 1:41 am #5760tehjrowGuest
+1 for the type-hinting and returning `: self` from the settersJanuary 14, 2021 at 1:41 am #5761theodorePjonesGuest
Sorry if this is a dumb question but I’m new to this sub. I need to set up a website for a new business and it will need to have a lot more functionality than something like squarespace or weebly. I have some background with coding so I was planning to use wordpress for the website and code what we need, but you mention wordpress isn’t popular here. Can you elaborate on why? Are there better website tools that I should use?January 14, 2021 at 1:41 am #5762jshariefGuest
Good luckJanuary 14, 2021 at 1:41 am #5763theodorePjonesGuest
Sorry if this is a dumb question but I’m new to this sub. I need to set up a website for a new business and it will need to have a lot more functionality than something like squarespace or weebly. I have some background with coding so I was planning to use wordpress for the website and code what we need, but you mention wordpress isn’t popular here. Can you elaborate on why? Are there better website tools that I should use?January 14, 2021 at 1:41 am #5764justlasseGuest
There’s also cpt ui which allows you to output php instead of shipping with the plugin. Perhaps inspiration?
- You must be logged in to reply to this topic.