Flowing on from REST API in joomla 3.4 with SLIM Framework PART 1 it’s time to to use the real power of Slim Framework. In this second part of tutorial series , we will use SLIM Framework in Joomla way of style to create powerful API.
As we learned in Part 1 of this article, how to load SLIM Framework in our joomla 3.4 project and how to instantiate SLIM framework, directory structure explained in part 1 of this tutorial, in this part we will create index.php file flowing our directory structure.
create index.php in /your_project/api/v1/index.php . and paste bellow code, hey don’t get confused by seeing this messy line of code , don’t worry i will explain each line.
- define(‘_JEXEC’, 1);
- define(‘_API’, 1);
- define(‘JPATH_BASE’, dirname(dirname(dirname(__FILE__))));
- // Include the Joomla framework
- require_once JPATH_BASE . ‘/includes/defines.php’;
- require_once JPATH_BASE . ‘/includes/framework.php’;
-For complete information, Read the full at: REST API in joomla 3.4 with SLIM Framework PART 2