PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, January 12, 2022

[FIXED] Yii2 app alongside CraftCMS utilizing YII2

 January 12, 2022     yii, yii2     No comments   

Issue

Currently I have an app that is built INSIDE of CraftCMS plugins. I'm extracting these classes out and into an independent Yii2 framework.

How does Yii2 framework know WHEN to receive a request and process it? For example with Craft I am able to POST to /index.php?action=/ctrl/ctrlname/action&data=somedata but I'm unsure of how to do this with Yii?

I want to run CraftCMS and a separate Yii2 framework on the same server (for now) so JS will be making $.ajax() requests to the backend and I need CraftCMS to pick up certain ones and Yii2 to pick up other ones.


Solution

I decided to write a custom index.php file that would require_once $path where $path was the path to the correct app index.php file for bootstrapping.

This way in my custom index.php it would detect which app I wanted to load (based on a url component in the request) and then bootstrap appropriately.



Answered By - Exziled
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing