Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jessebyarugaba/Unofficial-Uganda-Securities-Exhange-API/llms.txt

Use this file to discover all available pages before exploring further.

System requirements

Before installing the library, ensure your environment meets these requirements:
  • PHP: Version 5.6 or higher
  • ext-iconv: Required for character encoding conversion
  • ext-mbstring: Provides better decoding for multi-byte documents
  • ext-curl: Enables cURL download support in the HtmlWeb class
  • ext-openssl: Allows loading HTTPS pages when using cURL

Installation methods

Currently, this library is not available on Packagist. Installation requires manual download and inclusion in your project.

Manual installation

1

Clone the repository

Download the source code from GitHub:
git clone https://github.com/jessebyarugaba/Unofficial-Uganda-Securities-Exhange-API.git
2

Include the PortfolioManager class

Copy the necessary files to your project directory:
cp Unofficial-Uganda-Securities-Exhange-API/PortfolioManager.php /path/to/your/project/
cp Unofficial-Uganda-Securities-Exhange-API/simple_html_dom.php /path/to/your/project/
3

Include in your PHP code

Require the PortfolioManager class in your PHP files:
<?php
require_once 'PortfolioManager.php';

// Create an instance
$portfolioManager = new PortfolioManager();
?>

Alternative: Download as ZIP

You can also download the repository as a ZIP file:
  1. Visit the GitHub repository
  2. Click the green Code button
  3. Select Download ZIP
  4. Extract the files to your project directory
  5. Include PortfolioManager.php in your code

Verify installation

Test your installation with this simple script:
verify-installation.php
<?php
require_once 'PortfolioManager.php';

// Create instance
$portfolioManager = new PortfolioManager();

// Test the connection
try {
    $companies = $portfolioManager->getAllPortfolioCompanies();
    echo "Installation successful! Found companies data.\n";
    echo $companies;
} catch (Exception $e) {
    echo "Installation error: " . $e->getMessage() . "\n";
}
?>
Run the script:
php verify-installation.php
If successful, you should see JSON output with company data from the Uganda Securities Exchange.

Web server setup

To run the API in a web environment:
  1. Install XAMPP
  2. Copy project files to C:\xampp\htdocs\use-api\ (Windows) or /opt/lampp/htdocs/use-api/ (Linux)
  3. Start Apache from the XAMPP control panel
  4. Access via http://localhost/use-api/PortfolioManager.php

Troubleshooting

This error occurs when the library cannot connect to the Uganda Securities Exchange website.Solutions:
  • Check your internet connection
  • Verify that allow_url_fopen is enabled in your php.ini:
    allow_url_fopen = On
    
  • Install the ext-curl extension for alternative HTTP methods
  • Check if a firewall is blocking outbound connections
If you see garbled text or encoding errors:Solutions:
  • Ensure ext-iconv is installed:
    php -m | grep iconv
    
  • Install ext-mbstring for better multi-byte support:
    sudo apt-get install php-mbstring  # Ubuntu/Debian
    
When accessing HTTPS URLs fails:Solutions:
  • Install ext-openssl:
    sudo apt-get install php-openssl  # Ubuntu/Debian
    
  • Update your CA certificates:
    sudo update-ca-certificates
    

Next steps

Quickstart guide

Learn how to make your first API call

API reference

Explore all available methods