Download the PHP package evemarket/eve-market-details without Composer
On this page you can find all versions of the php package evemarket/eve-market-details. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package eve-market-details
EVE Online Public Crest Market API - PHP
Note: Never trust the packagist icon badge. Version: 0.15.0
composer require evemarket/eve-market-details
Eve Online Public Crest is a library that allows you to fetch Market Details and Historical Details. We allow access to things like Regions, Orders, Market Prices, Historical Data, Market Groups, Item Types and much more.
The Api of this library is straight forward, simple and easy to understand. It is important to understand that Eve's Public Crest API only allows 20 concurrent connections, we only create 18.
You can use this library with Eve Public Crest Laravel Bridge Extension. All you have to do is install the extension via composer, register the provider and associated facades and be on your way.
You can use this library and a stand alone. The key importance here is that if you use this with Laravel then instead
creating a new instance of the class you'll do ClassName::methodName()
API Key?
You do not need a token or an API key to access the EVE Online Public Crest API.
Return Values
All API calls documented below will return either a GuzzleHttp\Psr7\Response
object in the form of a call back or a container of data.
Some methods will require both a successful and rejected callback function to be passed in with appropriate parameters, as documented below.
We also suggest you save all relevant data, such as href specific data to a database. This allows you to pull from the database and fetch href's to then be passed in to gather other data. You should not need to ever construct the url your self as most of the relevant data is in a response. This libraries components are designed to work together to fetch any specific piece of information you need.
What this library is not
This library is not designed to fetch kill reports or any other aspect of Eve that is not directly related to the market in any fashion.
The Logs Give me a bunch of Curl 52 Errors
These are unavoidable. They Are hard to track down and even harder to deal with. You cannot catch them in a try catch. This seems to be an issue with the EVE Online Public Crest API or an issue with Guzzle or your environment.
How ever Eve Public Crest allows for 20 concurrent connections when we do pool based requests. We do only 18 as to not hit the rate limit. If you see any 503 errors then we have hit the rate limit and thats an issue with us.
What do I do about curl 52 errors?
I am unsure. If you have a solutions I would gladly take a PR.
Item Specific information
Each item in Eve can be fetched from the Market Types class below. How ever should you need details on a specific item, you can use the items href, example: https://crest-tq.eveonline.com/types/18/
You should When ever have to construct this url your self.
When you use the Market Types class below, you'll get a response back that contains objects which contain a type->href
property. This property can be used to get the specific details of an item.
The above should be super simple to understand. We inject a new client into the class instance, we then fetch the details for an item based off it's href and in a call back we can do something with the response that is returned. The response will be a GuzzleHttp\Psr7\Response
object.
The Market Classes
The market classes documented below contain classes like MarketGroups
, MarketHistory
, Order
, Prices
and Types
.
These classes all relate to the market in some way and the data returned from there could either be a response object or a container of data for you to save to the database or do what you wish with.
Keep in mind, you should never have to construct a url your self. All of the Market related classes will contain some kind of href in there response or container object that allows you to pass it into another API call.
Market Groups
Fetches all the groups available in Eve. This one can take a while so we suggest a job system. How ever the basics are simple:
You will need to do your own filtering at this stage to only save the groups you want. There is no way to query the Public Crest API it's self. Our API returns you all the groups and there associated pages.
Market History
If you ever wanted a set of historical data from a specific region with a specific or even set of, then this is class you will want. We highly suggest you use Regions class and Market Types class to get relevant information for this classes functions.
First of all you want to get the region id's and item's from the database. These are not the database id's these are Eve's id's For example: Eve Regions have an id field of: id: 11000001
for example.
Eve Types contain an array of object each with an id field: id: 18
for example. These are the id's you will want. These can be fetched by using the suggested classes above and saving the relevant data to the database.
Market Orders
Market orders allow you to get the selling and buying order from a specific region for a specific item.
We highly suggest you use Regions class and Market Types class to get relevant information for this classes functions.
You will need the item type href which you can get from the response of Market Types and the region href, which you can also get from the Regions response.
ATTN!
You should store the orders as you fetch them. While there might be new orders, you may want historical data.
You should also only fetch on demand and not try and fetch every single order across all items and all regions. This would be computationally expensive.
To get a single buy order:
To get a single sell order. Its the same concept as above:
But what if you want to search all the regions for any type of order?
Market Prices
This is a rather straight forward call. We make a call to https://crest-tq.eveonline.com/market/prices/ to get all the market prices in eve. This is refreshed every 24 hours, so make sure you have a cron job set up to run.
This is also the end point that CCP uses in game to show you a list of market prices when you view market details.
Market Types
Market Types gets you information about all the items known in eve. There are roughly over 10'000 items that are usable in game with a total of ~12k items that are both usable, not usable and test items from CCP. Make sure to do appropriate filtering.
This class should be used when ever you need to get information about an item such as Id, href and so on. Make sure to store the relevant bits of information in the database.
We will fetch every single page from https://crest-tq.eveonline.com/market/types/ and return an array of arrays, where each array inside the main holds the JSON response of that page.
Regions
This call is rather simple and, much like Market Types we heavily suggest that you store this information in the database to be called upon for other classes when fetching market data such as history or region buy/sell orders.
We will fetch every single region known. You will want to filter out every region with a hyphen in the name. These are either wormholes or CCP specific regions. This should leave you with an array of roughly 62 regions that players can interact with.