PHPackages                             codebjorn/thor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. codebjorn/thor

ActiveWp-plugin

codebjorn/thor
==============

WP Plugin Thor

0.1.0(4y ago)35MITPHP

Since May 30Pushed 4y ago1 watchersCompare

[ Source](https://github.com/codebjorn/thor)[ Packagist](https://packagist.org/packages/codebjorn/thor)[ RSS](/packages/codebjorn-thor/feed)WikiDiscussions main Synced 5d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

[![](https://camo.githubusercontent.com/af1d0ca3e6ed9bd82f092b2df917f92f37a83f2c1fcc1f769b973d58ba18dc8f/68747470733a2f2f692e696d6775722e636f6d2f5937366c5278652e706e67)](https://camo.githubusercontent.com/af1d0ca3e6ed9bd82f092b2df917f92f37a83f2c1fcc1f769b973d58ba18dc8f/68747470733a2f2f692e696d6775722e636f6d2f5937366c5278652e706e67)

Thor, WordPress Plugin Boilerplate
==================================

[](#thor-wordpress-plugin-boilerplate)

[![GitHub release](https://camo.githubusercontent.com/5182d1a73db731f949b8a1ea9a217267457b0ba3886226c8df023d76d90e9c2e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f636f6465626a6f726e2f74686f723f696e636c7564655f70726572656c6561736573)](https://github.com/codebjorn/thor/releases)[![Generic badge](https://camo.githubusercontent.com/52ad996b081d948d6585b4cb6efabd2c9d3daf5d07fadc7c3738021f01879222/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746162696c6974792d416c7068612d6f72616e67652e737667)](https://shields.io/)

Thor is WordPress Plugin Boilerplate using as a base [Mjolnir](https://github.com/codebjorn/mjolnir) Framework

If you think this approach is not working, please open an issue and let's discuss :)

Pre-Requirements
----------------

[](#pre-requirements)

Before we proceed further, I suggest you to read documentation for:

1. [Mjolnir](https://github.com/codebjorn/mjolnir) Framework.
2. [Laravel Blade](https://laravel.com/docs/6.x/blade)
3. [Laravel Mix](https://laravel-mix.com/)

Requirements
------------

[](#requirements)

Requirements for this boilerplate are:

- PHP 7.1+
- Composer

Installation
------------

[](#installation)

You can install framework via composer:

```
composer create-project codebjorn/thor
```

Structure
---------

[](#structure)

Structure of boilerplate is:

```
|-- app                   // Folder where is stored all Facades,Services,Providers
|   |--Facades            // Folder that stores all facades used to get utilities & services from container
|   |--Providers          // Folder that stores all your providers
|   |--App.php            // Container file
|   |--Helpers.php        // File that store all functions need it for project
|-- assets                // Folder where all builded assets are stored
|-- blocks                // Folder where are stored all Gutenberg blocks
|   |--      // Folder with block
|       |-- components    // Folder where are stored all js components for Gutenberg
|       |-- data          // Folder where are stored json files such as attributes
|       |-- view          // Folder where is stored blade files for render
|       |-- index.jsx     // Block configuration file
|   |-- blocks.js         // File where is imported all blocks
|   |-- blocks.php        // File where are registered blocks using Block Facade
|-- config                // Folder where are stored configurations
|-- hooks                 // Folder where is stored all hooks
|   |-- actions.php       // File where are created new action hooks using Action Facade
|   |-- filters.php       // File where are created new filter hooks using Filter Facade
|-- resources             // Folder that stores all js,scss,views elements of theme
|   |-- js                // Folder for js of theme
|   |-- scss              // Folder for scss of theme
|   |-- views             // Folder for blade templates
|-- vendor                // Composer packages folder
|-- thor.php              // Default plugin file
|-- webpack.mix.js        //Laravel Mix configuration file

```

How all work
------------

[](#how-all-work)

#### Add service into hook

[](#add-service-into-hook)

1. Create a new namespace in `app` folder and add new php service class
2. Resolve this service using Service Provider in `app/Providers` folder, you can add it to `AppServiceProvider.php` or create a new provider and add it to `config/app.php` to load. More info about [service providers](https://container.thephpleague.com/3.x/service-providers/)
3. After resolving a service you can [inject](https://container.thephpleague.com/3.x/dependency-injection/) it in another service or add it into hook in `hooks` folder, for example action hook:

```
Action::add('wp_enqueue_scripts', [\Namespace\Setup\Enqueues::class, 'front']);
Action::add('admin_enqueue_scripts', [\Namespace\Setup\Enqueues::class, 'admin']);
```

#### Create Gutenberg Blocks

[](#create-gutenberg-blocks)

All blocks are stored in `blocks` folder. For creating a new block we will need:

1. Create a folder inside `blocks` folder
2. Create `index.jsx` in your new folder

```
import {__} from '@wordpress/i18n';
import {Fragment} from '@wordpress/element';
import Controls from "./components/controls";
import Editor from "./components/editor";
import Inspector from "./components/inspector";
import * as attributes from "./data/attributes.json";

const {registerBlockType} = wp.blocks;

export default registerBlockType('namespace/name', {
    title: __('Name', 'name'),
    attributes: attributes,
    edit: props => {
        return (

        );
    },
    save() {
        //gutenberg will save attributes we can use in server-side callback
        return null;
    },
});
```

3. Create all components inside components folder:

- `controls.jsx` - Toolbar of block

```
import {BlockControls} from '@wordpress/block-editor';

function Controls() {
    return (

    );
}

export default Controls;
```

- `editor.jsx` - Main area of block

```
function Editor({attributes, setAttributes}) {
    console.log(attributes)
    return (

            Hello, {attributes.title}

    );
}

export default Editor;
```

- `inspector.jsx` - Sidebar panels

```
import {__} from '@wordpress/i18n';
import {InspectorControls} from '@wordpress/block-editor';
import {PanelBody, PanelRow} from '@wordpress/components';

function Inspector({attributes, setAttributes}) {
    return (

    );
}

export default Inspector;
```

4. Create `data` folder and new attributes.json file:

```
{
  "classNames": {
    "default": "hero",
    "type": "string"
  },
  "title": {
    "default": "This is title",
    "type": "string"
  }
}
```

Also, you can use data folder to store and other json folder that can be used in you block.

5. Create `view` folder where will be stored blade templates for your block, default one is `block.blade.php`:

```

 {{$attributes->title}}
 @include('hero.view.partials.element')

```

6. Import you block in main `blocks.js`
7. Add block in main `blocks.php` using block facade:

```
\Namespace\Facades\Block::add('namespace', 'name');
```

### Testing

[](#testing)

//TODO

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Dorin Lazar](https://github.com/codebjorn)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1813d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52886764?v=4)[Dorin Lazar](/maintainers/codebjorn)[@codebjorn](https://github.com/codebjorn)

---

Top Contributors

[![codebjorn](https://avatars.githubusercontent.com/u/52886764?v=4)](https://github.com/codebjorn "codebjorn (5 commits)")

### Embed Badge

![Health badge](/badges/codebjorn-thor/health.svg)

```
[![Health](https://phpackages.com/badges/codebjorn-thor/health.svg)](https://phpackages.com/packages/codebjorn-thor)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
