News
extends ResponseBase
in package
Class News
Represents news data for a stock and handles the response parsing.
Table of Contents
Properties
- $content : string
- The content of the article, if available.
- $headline : string
- The headline of the news article.
- $publication_date : Carbon
- The date the news was published on the source website.
- $source : string
- The source URL where the news appeared.
- $status : string
- The status of the response. Will always be "ok" when there is data for the symbol requested.
- $symbol : string
- The symbol of the stock.
- $csv : string
- $html : string
Methods
- __construct() : mixed
- Constructs a new News object and parses the response data.
- getCsv() : string
- Get the CSV content of the response.
- getHtml() : string
- Get the HTML content of the response.
- isCsv() : bool
- Check if the response is in CSV format.
- isHtml() : bool
- Check if the response is in HTML format.
- isJson() : bool
- Check if the response is in JSON format.
Properties
$content
The content of the article, if available.
public
string
$content
TIP: Please be aware that this may or may not include the full content of the news article. Additionally, it may include captions of images, copyright notices, syndication information, and other elements that may not be suitable for reproduction without additional filtering.
$headline
The headline of the news article.
public
string
$headline
$publication_date
The date the news was published on the source website.
public
Carbon
$publication_date
$source
The source URL where the news appeared.
public
string
$source
$status
The status of the response. Will always be "ok" when there is data for the symbol requested.
public
string
$status
$symbol
The symbol of the stock.
public
string
$symbol
$csv
protected
string
$csv
The CSV content of the response.
$html
protected
string
$html
The HTML content of the response.
Methods
__construct()
Constructs a new News object and parses the response data.
public
__construct(object $response) : mixed
Parameters
- $response : object
-
The raw response object to be parsed.
getCsv()
Get the CSV content of the response.
public
getCsv() : string
Return values
string —The CSV content.
getHtml()
Get the HTML content of the response.
public
getHtml() : string
Return values
string —The HTML content.
isCsv()
Check if the response is in CSV format.
public
isCsv() : bool
Return values
bool —True if the response is in CSV format, false otherwise.
isHtml()
Check if the response is in HTML format.
public
isHtml() : bool
Return values
bool —True if the response is in HTML format, false otherwise.
isJson()
Check if the response is in JSON format.
public
isJson() : bool
Return values
bool —True if the response is in JSON format, false otherwise.