Skip to content

Conversation

@Log1x
Copy link
Member

@Log1x Log1x commented Dec 30, 2021

I've removed this on every project I've made with Sage 10 up to this point as I can't really find a reason I'd use a messy global function over using a method inside of a Composer, a trait, or my own class.

Thoughts?

@github-actions github-actions bot added the php Pull requests that update PHP code label Dec 30, 2021
@retlehs retlehs added this to the 10.0.0-beta.3 milestone Dec 30, 2021
@retlehs
Copy link
Member

retlehs commented Dec 30, 2021

can we get the README and docs updated as well?

@retlehs retlehs merged commit ee889ed into main Jan 2, 2022
@retlehs retlehs deleted the log1x/remove-helpers-php branch January 2, 2022 20:11
@SergiArias
Copy link

SergiArias commented Jan 9, 2022

I've removed this on every project I've made with Sage 10 up to this point as I can't really find a reason I'd use a messy global function over using a method inside of a Composer, a trait, or my own class.

Thoughts?

I usually create functions inside helpers (not more than 5 per project) and I am interested to know deeper what would be the best approach. Maybe add a section in the documentation after this removal?

I understand that the simpler one is to add a method inside app/View/Composers/App so it's available to all the views.
In the case of a class/trait, where would we require/instantiate the class in the current folder structure? In bootstrap/app.php? In config folder?

I understand it would be the same concept of acf composer which creates classes inside Blocks, Fields and Options folders and instantiate the classes through acf composer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

php Pull requests that update PHP code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants