Skip to content

Instantly share code, notes, and snippets.

@webmechanicx
Created March 24, 2017 16:17
Show Gist options
  • Save webmechanicx/b267baeb508f498fa6dc9823cb8d074c to your computer and use it in GitHub Desktop.
Save webmechanicx/b267baeb508f498fa6dc9823cb8d074c to your computer and use it in GitHub Desktop.
Load the Joomla! Framework in a PHP Script
<?php
define( '_JEXEC', 1 );
// JPATH_BASE should point to Joomla!'s root directory
define( 'JPATH_BASE', realpath(dirname(__FILE__) .'/' ) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$user =& JFactory::getUser();
// display user object
print_r($user);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment