PHP code example of boxybird / atomic

1. Go to this page and download the library: Download boxybird/atomic 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/ */

    

boxybird / atomic example snippets


define('ATOMIC_ENCRYPTION_KEY', 'SOME_RANDOM_16_CHARACTER_STRING');

// Theme example:
tomic::init(get_stylesheet_directory_uri());

// Plugin example:
tomic::init(plugin_dir_url(__FILE__));

add_action('atomic/get/my-hook', function (int $post_id) {
    echo "<p>HTMX GET request fragment - ID: {$post_id}</p>";
});

add_action('atomic/get/my-other-hook', function (int $post_id) {
    echo "<p>HTMX GET request fragment - ID: {$post_id}</p>";
});

add_action('atomic/post/my-hook', function (int $post_id) {
    get_template_part('fragments/post', 'my-template', args: ['post_id' => $post_id]);
});

add_action('atomic/put/my-hook', ...);
add_action('atomic/patch/my-hook', ...);
add_action('atomic/delete/my-hook', ...);