service.yml location - newbe question

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
johnh530
Registered User
Posts: 2
Joined: Sat Jun 08, 2019 12:42 pm

service.yml location - newbe question

Post by johnh530 » Sat Jun 08, 2019 1:31 pm

In the tutorial for authentication at:
https://area51.phpbb.com/docs/dev/3.2.x ... ation.html

====
An authentication provider that comes with phpBB requires a minimum of two files: a class and an entry in a config/auth.yml file. Authentication providers that are part of an extension must provide their own YAML file defining the service in addition to all normal requirements of an extension.
====

The config directory on the distribution shows directories:
====
default installer production
====

It appears that production directory has links to default directory
The config.yml file in default directory has:
====
# phpBB's config file (This line is needed because of the packager)
====

There is also a container directory in default directory which has service.yml with a number of included service_...yml files.

Later in the tutorial is states:
====
For proper dependency injection the provider must be added to services.yml. The name of the
====

Questions:

Am I in the right area for the service.yml file I need to create?
Do I need to make any changes to config.yml?
The services.yml file I need to create - Do I create a file in config/default/container and include it in config/default/container/services.yml?

johnh...

rxu
Extensions Development Team
Posts: 2973
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: service.yml location - newbe question

Post by rxu » Sun Jun 09, 2019 4:52 am

You shouldn't change phpBB core files ever. That's about your extension's directory, so your custom config.yml has to be located in your extension's /config subdirectory (not in phpBB core), so you just create /config/config.yml file in your extension, then you add some services into it.

johnh530
Registered User
Posts: 2
Joined: Sat Jun 08, 2019 12:42 pm

Re: service.yml location - newbe question

Post by johnh530 » Tue Jun 11, 2019 4:28 am

Thanks for your reply - I found the skeleton extension and created an auth extension - enabled it - and it shows up on authentication lists in the general tab of the ACP.

I still am confused by the documentation and don't seem to be able to get into the constructor of the class.

In my post I quoted the documentation about needing to add an entry to config/auth.yml then later talks about services.yml. I mistakenly switched config/auth.yml to config/config.yml - my bad.

I think you are indicating I need create the config/auth.yml file and add some service to it.
I have a services.yml file following the tutorial.

When I enable the authentication extension and select it as the authentication on the General->Client Communication->Authentication I am unable to login and any logging even in the constructor of the class does not occur. I'm pretty sure the object is not being created.
I see no errors in the apache logs.

Questions:
1) if config/auth.yml needs to be created exactly what does it need to look like? - what is it's relation to the services.yml file?
2) If making a change to an extension - either php or yml - is a disable and re enabling enough to get the changes be effective?
3) If there is an issue with config - are there any logs which record this issue?

johnh...

ingo169
Registered User
Posts: 1
Joined: Sun Jun 23, 2019 10:14 am

Re: service.yml location - newbe question

Post by ingo169 » Sun Jun 23, 2019 10:20 am

Hi, I have the exact same question - the tutorial seems inconsistent. Can anybody give us a hint on how to do it? Where should wich file with which name be placed?

rxu
Extensions Development Team
Posts: 2973
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: service.yml location - newbe question

Post by rxu » Mon Jun 24, 2019 1:13 pm

The only config file phpBB parses is config.yml. In common, you can simply put all of your services there.
Splitting services into several config files is being used just for better coding style and readability.
All config files other than config.yml in /config folder have to be imported into config.yml using imports operator.

if you're going to change config file (during extension development for example), you have to disable the extension, then apply changes, then enable extension.
If there're any issues with services, you will most likely find it out immediately as far as such kind of issues create PHP fatal errors.

User avatar
david63
Registered User
Posts: 16564
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: service.yml location - newbe question

Post by david63 » Mon Jun 24, 2019 1:28 pm

rxu wrote:
Mon Jun 24, 2019 1:13 pm
if you're going to change config file (during extension development for example), you have to disable the extension, then apply changes, then enable extension.
Unless you are working in Development environment.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
3Di
Former Team Member
Posts: 14239
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: service.yml location - newbe question

Post by 3Di » Mon Jun 24, 2019 8:46 pm

You can edit the .yaml file and simply purge the cache.
Doesn't matter which environment you are working in and no need of the disable/reenable steps.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
david63
Registered User
Posts: 16564
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: service.yml location - newbe question

Post by david63 » Mon Jun 24, 2019 9:15 pm

3Di wrote:
Mon Jun 24, 2019 8:46 pm
You can edit the .yaml file and simply purge the cache.
Agreed - but in development environment you do not need to purge the cache, it does it for you.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
3Di
Former Team Member
Posts: 14239
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: service.yml location - newbe question

Post by 3Di » Mon Jun 24, 2019 9:22 pm

Question of habits, I wanted to clarify this point.
I am used to delete the cache from my editor, no ACP: http://prntscr.com/o65k51
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

Post Reply

Return to “Extension Writers Discussion”