sciwp / sciwp-framework

A MVC Framework for WordPress
https://sciwp.com
GNU Lesser General Public License v2.1
14 stars 3 forks source link

Install issues #3

Open james182 opened 3 years ago

james182 commented 3 years ago

Keep getting this error when activating: Plugin could not be activated because it triggered a fatal error. Please rebuild MVC WP.

main.php `defined('WPINC') OR exit('No direct script access allowed');

namespace wpChurchManager;

use wpChurchManager\Sci; use wpChurchManager\Sci\Plugin\Plugin;

include plugin_dir_path(FILE).'framework/run.php';

Plugin::create(FILE)->register('wp-church-manager');`

I have the structure as: wp-church-manager -- app -- framework -- config.php --main.php

edulazaro commented 3 years ago

Hi James;

Here is how you can bundle the framework with your plugin:


namespace wpChurchManager;

# Start the framework
include plugin_dir_path(__FILE__) . 'framework/run.php';

# Create a new Plugin and register it into the Plugin Manager
wpChurchManager\Sci\Plugin\Plugin::create(__FILE__)->register();

And here is a basic config.php file:


return array (
    'rebuild' =>  true,
    'folders' => [  
        'main' => 'app',
        'modules' => 'modules',
    ],
    'activation' => [
        'php' => [
            'enabled' => true,
            'version' => '7.2',
            'message' => __('The %1$s plugin requires PHP version %2$s or greater.', 'text-domain'),
        ],
        'wordpress' => '5.0',
    ],
    'autoloader' => [
        'cache' => true,
        'reflexive' => true,
    ],
    'services' => [

    ],
    'providers' => [

    ],
);

If the namespaces have been corrupted, just delete and copy the framework folder again.

The boilerplate was outdated; it's now updated.