Jump to content

Where is the right place for define 3rd party lib?


Numbered

Recommended Posts

Posted

As that doc said we should define our 3rd party lib with that line 

\IPS\IPS::$PSR0Namespaces['Libary'] = \IPS\ROOT_PATH . '/applications/app/system/3rd_party/Library';

I use the PhpAmqpLib in my app. So i created new folders in my app folder 'system/3rd_party/PhpAmqpLib' and put line in file, which use that lib (one of task)

<?php
/**
 * @brief		myAppSomeMQ Task
 * @author		<a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
 * @copyright	(c) Invision Power Services, Inc.
 * @license		https://www.invisioncommunity.com/legal/standards/
 * @package		Invision Community
 * @subpackage	app
 * @since		15 Feb 2018
 */

namespace IPS\app\tasks;

\IPS\IPS::$PSR0Namespaces['PhpAmqpLib'] = \IPS\ROOT_PATH . '/applications/app/system/3rd_party/PhpAmqpLib';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Exception\AMQPProtocolChannelException;
use PhpAmqpLib\Message\AMQPMessage;
use PhpAmqpLib\Wire\AMQPTable;

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * myAppSomeMQ Task
 */
class _myAppSomeMQ extends \IPS\Task
{
	// my code..
}

Is that is right using of define \IPS\IPS::$PSR0Namespaces ?

I'm sure some better place should exist. Please, tell me where to connect it correctly. Thanks.

P.S. All works well. No problems with lib and it using. My question just for make it working in good method.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...