Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Open Y Socrates

Security covered Maintenance fixes only 149 sites

This module implements a strategy pattern to manage pluggable data wrapper services with varying priorities. It allows you to define which service should be used to retrieve data based on the highest priority defined for a specific project. This can also be extended to manage cron services with specified periodicities.

πŸ‡ΊπŸ‡¦

This module is maintained by Ukrainian developers.
Please consider supporting Ukraine in a fight for their freedom and safety of Europe.

Socrates is an OOP representation of https://en.wikipedia.org/wiki/Strategy_pattern for Open Y to cover needs of pluggable distributed Data Wrapper services by priority.

Basically, if you have a membership calculator which should be used for display same thing but for different Data Services, Socrates gives you a convenient opportunity to define which service should be used for obtaining data on specific project. The highest priority service will be chosen for retrieving data.

For connecting your service to Socrates you need to

  • implement OpenyDataServiceInterface for the service's class
  • extend your_module.services.yml with tags
  <span class="hljs-attribute">example_socrates_data_service</span>:
    <span class="hljs-attribute">class</span>: Drupal\openy_socrates\ExampleSocratesDataService
    <span class="hljs-attribute">tags</span>:
      - { <span class="hljs-attribute">name</span>: openy_data_service, <span class="hljs-attribute">priority</span>: <span class="hljs-number">1000</span> }
  • replace the Data service with Socrates everywhere you need to have an ability to prioritize Data retrieving.

For connecting your service to Socrates Cron you need to:

  • implement OpenyCronServiceInterface for the service's class
  • extend your_module.services.yml with a tags
<span class="hljs-attr">  example_socrates_cron_service:</span>
<span class="hljs-attr">    class:</span> Drupal\openy_socrates\ExampleSocratesCronService
<span class="hljs-attr">    tags:</span>
<span class="hljs-bullet">      -</span>
<span class="hljs-attr">        name:</span> openy_cron_service
        <span class="hljs-comment"># In seconds from the last run.</span>
<span class="hljs-attr">        periodicity:</span> <span class="hljs-number">60</span>

Add the command to your crontab:

<span class="hljs-bullet">* </span><span class="hljs-bullet">* *</span> <span class="hljs-bullet">* *</span>   drush ev '\Drupal::service("socrates")-&gt;cron();'

Your data class usage with Socrates is fairly simple:

  <span class="hljs-comment">/* <span class="hljs-doctag">@var</span> \Drupal\my_module_data_service\dataService $dataService */</span>
  $myDataService = \Drupal::service(<span class="hljs-string">'socrates'</span>);
  $myDataService-&gt;myMethod();
Drupal 10–11

Ask your assistant about Open Y Socrates

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

1 tracked project depends on this one

Activity

Tracked releases
4
Tracked since
May 2025
Latest release
22 hours ago
Releases (12 mo)
2
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.2.1 Stable 10–11 Oct 15, 2026
1.2.0 Stable 10–11 Oct 8, 2026
1.1.0 Stable 10–11 Jun 30, 2025
1.0.4 Stable 9–11 May 2, 2025