Comments (4)
There are 2 problems, the name you have to put in composer.json
is not the GitHub repository name, but name that is set in composer.json
for the repo.
After that, I guess that you want to use your fork, not the original plugin repo. I guess that because I read in the error message: "The requested package bruno-barros/cortex-plugin ..."
If you want to use your fork you need to specify the repositories
setting in composer.json
(see docs) and not to change package name (unless you change it in your fork).
So, your composer.json
should be something like:
"require": {
"php": ">=5.4",
"brain/cortex-plugin": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/bruno-barros/Cortex-Plugin"
}
],
"minimum-stability" : "dev",
"prefer-stable": true
Regarding introducing a tag version, that's planned, but as long as you use
"minimum-stability" : "dev",
"prefer-stable": true
it should work with any issue.
from cortex.
Yeah. Now I'm able to install the plugin. I configured the composer.json to install the plugin on mu-plugin
folder, but the Brain\Cortex::boot();
is not booting the modules anymore.
In the docs I see it must be just after the autoload.php
, but on my case, the autoload.php
is required before the Wordpress bootstrap.
# wp-config.php
require_once('src/config' . DS . 'start.php');
require_once(ABSPATH.'wp-settings.php');
# src/config/start.php
require_once 'vendor/autoload.php';
Doesn't matter where I call Brain\Cortex::boot();
. It isn't booting.
So, should I keep Brain modules on it own vendor folder to require and booting, or can I do it in this scenario?
from cortex.
Yep, all Brain modules are intended to be used in WordPress context.
If you load Composer autoload before loading WP environment you are trying to load Brain modules before WordPress is available and it will not work as expected.
However, I think that load all Brain modules manually should work.
You need to create a mu-plugin that contain something like:
<?php
add_action( 'brain_init', function( $brain ) {
$brain->addModule( new Brain\Amygdala\BrainModule );
$brain->addModule( new Brain\Striatum\BrainModule );
$brain->addModule( new Brain\Cortex\BrainModule );
} );
add_action( 'after_setup_theme', function() {
Brain\Container::boot( new \Pimple\Container );
}, 0 );
Save this file and put in mu-plugin folder.
After that, be sure that WordPress does not load Cortex as a mu plugin, because all the loading is done by this file, so you only need that proper classes are available, and that is assured by the Composer autoload.
In facts, you don't need Cortex plugin, the Cortex package should be absolutely fine in your case, you can install it using "brain\cortex": "dev-master"
instead of "brain\cortex-plugin": "dev-master"
.
from cortex.
Man, thank you.
It was exactly what I needed.
from cortex.
Related Issues (20)
- Overriding `template_include` hook HOT 6
- Sage 9 Integration HOT 6
- Simple example not fired. HOT 1
- About template HOT 2
- [Question] Is there any way to give Cortext routes a higher priority over WP routes? HOT 5
- Preserving variables? HOT 1
- [Question] could you describe how to do a paginated route? HOT 1
- [feature request] Closures as a value for the `template` setting HOT 4
- Render specific post/page/tax archive HOT 1
- How to add body classes depending on a Cortex route - the right way. HOT 2
- Current status for this project? HOT 4
- AJAX requests handling - how to set up CORS? HOT 3
- Routes "players" and "players/" are treated as same url HOT 2
- Handle 404 error HOT 2
- Abandoned packages and Parse error | PHP 8.0.11 HOT 1
- post__in not working HOT 1
- Wordpress 6 Changing on do_parse_request HOT 1
- Issue with wordpress v6 HOT 4
- get_post() does not work
- PHP dependency conflict: "psr/http-message" now requires PHP 7.2 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cortex.