PHP code example of rmp-up / wp-di

1. Go to this page and download the library: Download rmp-up/wp-di library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rmp-up / wp-di example snippets


RmpUp\WpDi\WpDi::load( pDi\WpDi::pimple();

RmpUp\WpDi\WpDi::load(
	RmpUp\WpDi\Yaml::parseFile( 'services.yaml' )
);
json
{
  "autoload": {
    "files": [ "vendor/rmp-up/wp-di/preload.php" ]
  }
}
yaml
services:
  # Access PHP-Constants
  InjectingConstants:
    arguments:
      - !php/const ABSPATH

  # Concatenate text
  ThisIsSomeTemplate:
    arguments:
      - !join [ !php/const WP_CONTENT_DIR, "/plugins/grey-matter/walter.jpg" ]

  # Translations within YAML
  ThisThingNeedsTranslations:
    arguments:
      - !__ [ Who is Adam?, dark ]
      - !esc_attr__ [ white ]
      # ... many more translation functions available ...