Download the PHP package nishantwebdev/nse-stock-data-php without Composer

On this page you can find all versions of the php package nishantwebdev/nse-stock-data-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nse-stock-data-php

NSE India API - PHP Library

A comprehensive PHP library for accessing NSE (National Stock Exchange) India stock market data. This library provides easy-to-use methods to fetch real-time and historical stock data, and more.

Features

Installation

Using Composer (Recommended)

Manual Installation

  1. Clone this repository:

  2. Install dependencies:

Quick Start

Usage Examples

Main Methods

getEquityDetails(string $symbol): EquityDetails

Get comprehensive equity information including price, volume, and company details.

getEquityHistoricalData(string $symbol, DateRange $range): array

Get historical stock data for a specified date range.

getEquityIntradayData(string $symbol, bool $isPreOpenData = false): IntradayData

Get real-time intraday price data.

getIndexOptionChain(string $indexSymbol): OptionChainData

Get option chain data for indices (NIFTY, BANKNIFTY, etc.).

getEquityOptionChain(string $symbol): OptionChainData

Get option chain data for individual stocks.

getDerivativeData(string $symbol): array

Get futures and options data for a stock.

checkHoliday(DateTime $date): bool

Check if a given date is a trading holiday.

getAllStockSymbols(): array

Get list of all available stock symbols.

getHolidayData(): array

Get holiday data for the current year (cached automatically).

getHolidayDataForYear(int $year): array

Get holiday data for a specific year.

clearHolidayCache(?int $year = null): bool

Clear holiday cache for a specific year or all years.

Complete Method Documentation

Holiday and Market Status Methods

checkHoliday(DateTime $date): bool

Check if a given date is a trading holiday. Returns true if the date is a holiday (weekend or trading holiday), false otherwise.

Parameters:

Returns: bool - true if holiday, false if trading day

Example:

getMarketStatus(): MarketStatus

Get current market status including market state, trade date, and other market information.

Returns: MarketStatus - Object containing market status details

Example:

Index Methods

getAllIndices(): array<Index>

Get all available market indices with their current values and changes.

Returns: array - Array of Index objects containing index information

Example:

getEquityStockIndices(string $index): IndexDetails

Get detailed information for a specific equity stock index.

Parameters:

Returns: IndexDetails - Object containing detailed index information

Example:

Equity Information Methods

getEquityDetails(string $symbol): EquityDetails

Get comprehensive equity information including price, volume, company details, and market data.

Parameters:

Returns: EquityDetails - Object containing complete equity information

Example:

getEquityTradeInfo(string $symbol): EquityTradeInfo

Get detailed trade information for a specific equity including volume, value, and trade statistics.

Parameters:

Returns: EquityTradeInfo - Object containing trade information

Example:

getEquityCorporateInfo(string $symbol): EquityCorporateInfo

Get corporate information for a specific equity including company details, announcements, and corporate actions.

Parameters:

Returns: EquityCorporateInfo - Object containing corporate information

Example:

getEquityIntradayData(string $symbol, bool $isPreOpenData = false): IntradayData

Get real-time intraday price data for a specific equity.

Parameters:

Returns: IntradayData - Object containing intraday price data

Example:

Historical Data Methods

getEquityHistoricalData(string $symbol, DateRange $range = null): array<EquityHistoricalData>

Get historical stock data for a specified date range. If no range is provided, defaults to the last month.

Parameters:

Returns: array - Array of historical data objects

Example:

getEquityPriceByDate(string $symbol, DateTime $date): int|float

Get the closing price of a stock for a specific date. If the date is a holiday, returns the price from the last trading day.

Parameters:

Returns: int|float - The closing price for the specified date

Throws: Exception if no data is found for the given date

Example:

getIndexHistoricalData(string $index, DateRange $range): array<IndexHistoricalData>

Get historical data for a specific index over a date range.

Parameters:

Returns: array - Array of historical index data

Example:

Holiday Data Management Methods

getHolidayData(): array

Get holiday data for the current year. Data is automatically cached to improve performance.

Returns: array - Array of holiday dates in 'd-M-Y' format

Example:

clearHolidayCache(?int $year = null): bool

Clear cached holiday data for a specific year or all years.

Parameters:

Returns: bool - true if cache was cleared successfully

Example:

Data Models

The library provides strongly-typed data models for all API responses:

Error Handling

The library throws exceptions for various error conditions:

Rate Limiting

The library includes built-in rate limiting and connection management to respect NSE's API limits. It automatically handles:

Requirements

Examples

Check the examples/ directory for more detailed usage examples:

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This library is for educational and research purposes. Please ensure compliance with NSE's terms of service and applicable regulations when using this library for commercial purposes.

Support

For issues and questions:

Changelog

See CHANGELOG.md for a list of changes and version history.


All versions of nse-stock-data-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
nesbot/carbon Version ^3.10
guzzlehttp/guzzle Version ^7.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nishantwebdev/nse-stock-data-php contains the following files

Loading the files please wait ...