These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Yapeal PHP API library (2.0)

Author
Dragonaire
Here there be Dragons
#161 - 2014-10-20 03:35:13 UTC
Hi everyone just thought I'd let people know about some of the updates I been putting out over the last week or two. Mostly some small issues with some lesser used API like eve/CharacterInfo. I also did some refactoring on how Yapeal does it's XSL transforms which should help out with future Eve API changes since CCP is paying more attention to it again and seem that there is a full-time person in CCP FoxFour working on it and the CREST stuff which is great, but means things change more often which can cause more updates for me to do as well in Yapeal. The XSL changes should more future proof against any reordering of the XML etc that sometimes happens which breaks the XSDs. This mostly happened on Eve APIs that used a lot of elements instead of attributes in the rows.

After the last update I just finished Yapeal should now have all the updates it'll need for Phoebe which is expected Nov 4th. That of course is assuming there aren't any more made by FoxFour before then Blink He have hinted he might look at a couple more things after getting back from the get together in Vegas which I was sad to miss Sad

On some other sad news I will probably NOT have as much time to work on stuff in Yapeal do to RL issues so I will probably need someone to take over again and keep Yapeal going. I would like to have someone step forward now so I can help them get up to speed and give them access on GIthub etc so if I do end up NOT having any time they can keep everything going. This really needs to happen in the next day or two because after that I'm NOT sure I'll be where they can contact me. So please if you can help out let me know.

As always thank you for use Yapeal, Dragonaire.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Dragonaire
Here there be Dragons
#162 - 2014-10-29 05:41:27 UTC
Hi everyone,
So I been working on another little project over the last couple of days and while doing some testing using Yapeal version history I noticed that Yapeal is coming up on its 6th year here at the end of the month. Yapeal had existed for a few months as part of another corporation project before this and even as a separate project but the old Sourceforge SVN has long ago been deleted so records of the earlier code is probably lost now.

We do have the history starting from when I start working with some other developers on what was going to be a open source Eve API framework that everyone could use to make their own tools. Yapeal was going to be the core API library for the tool and one of the developers suggested that GoogleCode might be better place to do it than Sourceforge. I liked some of the features GoogleCode had at the time too so I moved Yapeal over. When I made that move there wasn't any good tools to import from one SVN into another so I simple created the new project and copied over the files and committed them. Yapeal has of course been host other places since then in several different versioning software (SVN, Mercurial, GIt) but I've been able to import the history from one to the other every since when I changed Yapeal over.

As I was saying Yapeal has been hosted on SF, GoogleCode, BitBucket (Not public), back to SF, and finally the move to GitHub. In most cases I made the move because either the new host offered one or more things I found useful or in one case (GoogleCode) they removed features that I needed and/or wanted. I probably would have moved directly from GC to GitHub but at the time I still didn't know enough about Git to see the advantage of using it vs Mercurial which Yapeal was using at the time.

For those of you that want to have a look at this very early version of Yapeal you can see it here.

A few things to notice is that even though it was called Yapeal there was no yapeal.php file yet you actually ran it using the backend/eve-api-pull.php file. One thing I just noticed while looking at that file is the old SVN revision number that would have come directly from the old SVN on SF since I hadn't set it up yet on GC to update.

$Revision: 20 $ $Date:: 2008-10-24 00:48:59 #$

The reason it was so low is I had just make Yapeal public on SF not more than a couple weeks before as I remember it. Before that I'd hosted on a private server either at my home or probably at a friend's place because he had a better internet connection and more HD space Smile Just a few other things to notice is that Yapeal was mostly procedural code at this time with just a few classes being used. It only worked with about a dozen APIs from the eve, corp, and char sections. Most of the char APIs were very new since the eve and corp ones had been the main focus of development up to that time. It's worth looking through the Docs/User Guide/User Guide.xml file to get a bit of an overview on my vision for Yapeal etc. It's actually the source DocBook file for the HTML and PDF files that would have been included in the tgz and zip files that was the expected way for people to install it at the time. Unlike now where the developer tools are just included with Yapeal I actually had another separate project for all of the development stuff I also had to maintain etc.

What I notice when looking back on this original code is how many of the ideas that I had already developed about how to make things work already existed and can still be seen at least by me even today in it. There are also parts of it that just make me want to hide because some of the code has some really ugly hacks in it. I have to give myself a little credit though because I was working within the limits set by PHP 5.2 and this was really my first project written in PHP. I was in many case still learning about all the commands etc of PHP and first applying what I'd just learned in Yapeal. I think I'd first become interest in learning PHP only 6 months to a year before I start Yapeal and it was by far the biggest project I had ever done. Before this I had always been more into hardware than software and playing around with some JS for web pages.

Anyway I hope everyone has enjoyed the little trip with me down memory lane and here's to at least another 6 years for Yapeal, Dragonaire.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Dragonaire
Here there be Dragons
#163 - 2014-10-29 17:30:20 UTC
So after StGoe reminded me that it didn't exist I've added an option to turn off the file system caching for the XML. The new default is for it to be off as that's probably the most useful for people at least in production. Also while I was at it I added a setting to allow you to change the name and location of the main cache directory with the default being its current location. If you just want to use the defaults you don't need to update your config/yapeal.yaml file although it wouldn't hurt to do so Blink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Dragonaire
Here there be Dragons
#164 - 2014-11-04 03:14:34 UTC
So just finished pushing out an update that should have all the updates needed for Phoebe. Only real breaking things should be the changes to the CharacterSheet tables so if you use it make sure you don't do this update until the Eve update happens. I may have another small update after it comes out in case there are any differences that I couldn't test for on the test server or if CCP made any last minute updates etc Smile

Make sure you've read https://developers.eveonline.com/ for all the API changes that might be affecting any tables you use. Basically for charCharacterSheet there some new columns and the charAttributeEnhancers table is gone and replaced by charImplants table that will also have the slot 6-10 implants as well. Also two new tables charJumpClones, and charJumpCloneImplants. There are a couple other changes to some other APIs but I've already deployed them as they didn't make any breaking changes just add a couple of new columns in tables and I set them as optional which I'll probably update sometime after this update to make them required as needed.

Let me know about any problems and I'll make sure to do updates to fix anything I missed.

As always thanks for using Yapeal, Dragonaire.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Tiberius Zol
Moira.
#165 - 2014-11-04 10:08:56 UTC
As always...good work. I am really excited about your work here. :)

Mr. Tibbers on twitter: @Mr_Tibbers

Mr. Tibbers Blog: www.eve-versum.de

Tiberius Zol
Moira.
#166 - 2014-11-04 10:29:12 UTC
Run in an error after the update:


......CALL "evedb"."AddOrModifyColumn"('evedb',
'yp2_charCharacterSheet',
'DoB',
'DATETIME NOT NULL AFTER "corporationName"')
Sql failed in /htdocs/eve/yapealneu/bin/sql/updates/201411031600.sql on statement 6 with (22007) SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'DoB' at row 1

Mr. Tibbers on twitter: @Mr_Tibbers

Mr. Tibbers Blog: www.eve-versum.de

Legedric Striker
State War Academy
Caldari State
#167 - 2014-11-04 11:28:40 UTC
I am getting this at some point:

Quote:
[2014-11-04 11:25:27] yapeal.DEBUG: Class not found Yapeal\Database\Eve\CertificateTree [] []

EVE-Skillplan.net - Plan your pilot skill training online on PC, Mac, tablet or smartphone!

Dragonaire
Here there be Dragons
#168 - 2014-11-04 15:47:37 UTC
Legedric Striker - that's normal for any API that haven't been implemented yet.

Tiberius Zol - Looks like some how you already have some invalid existing rows in your charCharacterSheet table. Probably the best way to handle it is to just truncate it and let Yapeal do it's thing to refill it. Might delete any characterSheet rows in utilCachedUntil to speed up the process.

The only reason I was updating that column is it was out of order and I didn't change it in any other way. DoB has always been a required column with no default value so you really shouldn't be getting an error there except if you have edit the row or found a way to import it without the DB giving the same error before and you worked around it Blink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Dragonaire
Here there be Dragons
#169 - 2014-11-04 20:07:15 UTC
Some of you might have noticed a small problem with the cloneImplants stuff but I've already pushed an update.
https://github.com/Dragonrun1/yapeal/issues/80

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Norian Lonark
Center for Advanced Studies
Gallente Federation
#170 - 2014-11-10 11:48:22 UTC
Hello Everyone,

I have been using Yapeal for a while now to run a couple of corporation apps but my knowledge of web programming is quite limited. I had no problems getting the old versions up and running (quite simple unpack, upload, run the install file), but am at a bit of a loss with the latest update and how to actually install it.

I am using a host so only have access to ssh command line and just wondered if anyone had some hints or tips / guide for setting up the new version of Yapeal not locally on your on machine but with a webhost as I am a bit lost Shocked

Many thanks for any help Big smile

Start wide, expand further, and never look back

Dragonaire
Here there be Dragons
#171 - 2014-11-10 22:22:28 UTC
Norian Lonark - Since you have SSH access you have several options. If you are working on a new project or a major update to an existing one if you converted to using Composer for your dependances it's simple to add Yapeal as one of them. Another option since you can also get Yapeal as a zip file directly from Github is to get it that way and just unzip it where you need it. If you are using some kind of version control like Git you can also setup Yapeal as a subtree like I did with Pimple so you can import it and update stuff as bugs and other updates are done to Yapeal. Git has option to create a compress or uncompressed archive which can be sent over a SSH connection as well. Those are just the options I came up with off the top of my head Blink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Norian Lonark
Center for Advanced Studies
Gallente Federation
#172 - 2014-11-11 15:53:34 UTC  |  Edited by: Norian Lonark
Thanks a lot for the help. I am making progress :)

I uploaded the files, did the composor bit and then ran the yc D:U command but get the following error:

Sql failed in DatabaseUpdater::addDatabaseProcedure on statement 0 with (HY000) SQLSTATE[HY000]: General error: 1548 Cannot load from mysql.proc. The table is probably corrupted

Just wondered if you had any ideas?

Edit... I figured it out and its all working great as expected.

Many thanks for your great work and for the hints Big smile

Start wide, expand further, and never look back

Battle On
GoonWaffe
Goonswarm Federation
#173 - 2014-11-13 18:52:47 UTC
Hi,

I've just pulled in yapeal 2.0 using composer and I wanna start using it.
I created the database and setted up the config file, but i miss the documentation on how to use this library?
I looked trough the github wiki but everything seems to be for 1.*...
my question, is there a guide somewhere for 2.0 already? I'd love to start using this library :)

Thanks in advance,
Battle On

Jita Exiles Productions is RECRUITING

Join -JXT- Public for more information

Dragonaire
Here there be Dragons
#174 - 2014-11-13 19:11:22 UTC
Thought I'd documented that some where but easiest way to manually start Yapeal or use it in a crontab etc is to use bin/yapeal.php. It works basically the same as the old yapeal.php did. There are also options to call any of the per API classes directly for one-shot type needs as that was one of the planned features to be added with this rewrite.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Battle On
GoonWaffe
Goonswarm Federation
#175 - 2014-11-13 19:37:26 UTC
Dragonaire wrote:
Thought I'd documented that some where but easiest way to manually start Yapeal or use it in a crontab etc is to use bin/yapeal.php. It works basically the same as the old yapeal.php did. There are also options to call any of the per API classes directly for one-shot type needs as that was one of the planned features to be added with this rewrite.


Do you have some examplecode that can be used for certain standard calls like validating an Character Api Key with keycode and validationcode or retrieve the Charactersheet? This way its earier to understand.

Jita Exiles Productions is RECRUITING

Join -JXT- Public for more information

Dragonaire
Here there be Dragons
#176 - 2014-11-16 19:40:22 UTC
Battle On - There really aren't any tutorial type docs like you are looking for. One reason for that is that I find it very hard to write anything useful to anyone new to Yapeal since I wrote 95+% of the code and have been work with it for over 6 years now. I just don't see it the way someone looking from outside does. In the past there has been a couple people that wrote about how to use the old version that I then edit and tried to maintain but so far no one has done the same thing for the current version. My suggestion on how to learn to use the individual API classes is to follow the code from bin/yapeal.php through lib/Yapeal.php and on to how the AutoMagic() calls oneShot() in the class you are interested in. It would be great if someone like you that is just learning to use Yapeal would write about it but so far no one has.

If after looking through stuff you still have questions you are welcome to ask on this thread or even contact me via E-mail etc. I'm also usually available on G-Talk and IRC when I'm at home near the computer. And for those that prefer talking to typing I can usually be talked into some voice comms as well if you really prefer that.

In other news I decided since I'm current not doing much new development work on Yapeal right now and the rate of bugs being reported is slowed down it was about time to do a tagged release so now you'll see a 2.0.0 version on GitHub and at Packagest as well if you look. I'd been thinking about doing this for at least a month but decided to wait until after Phoebe changes were merged into master and any needed fixes had been done.

As always thank you for using Yapeal, Dragonaire.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Battle On
GoonWaffe
Goonswarm Federation
#177 - 2014-11-17 08:44:29 UTC
Dragonaire wrote:
Battle On - There really aren't any tutorial type docs like you are looking for. One reason for that is that I find it very hard to write anything useful to anyone new to Yapeal since I wrote 95+% of the code and have been work with it for over 6 years now. I just don't see it the way someone looking from outside does. In the past there has been a couple people that wrote about how to use the old version that I then edit and tried to maintain but so far no one has done the same thing for the current version. My suggestion on how to learn to use the individual API classes is to follow the code from bin/yapeal.php through lib/Yapeal.php and on to how the AutoMagic() calls oneShot() in the class you are interested in. It would be great if someone like you that is just learning to use Yapeal would write about it but so far no one has.

If after looking through stuff you still have questions you are welcome to ask on this thread or even contact me via E-mail etc. I'm also usually available on G-Talk and IRC when I'm at home near the computer. And for those that prefer talking to typing I can usually be talked into some voice comms as well if you really prefer that.

In other news I decided since I'm current not doing much new development work on Yapeal right now and the rate of bugs being reported is slowed down it was about time to do a tagged release so now you'll see a 2.0.0 version on GitHub and at Packagest as well if you look. I'd been thinking about doing this for at least a month but decided to wait until after Phoebe changes were merged into master and any needed fixes had been done.

As always thank you for using Yapeal, Dragonaire.


Oke ill fool around with it then and see if i can get it to work.
As of the "turoial/examples", if i get it to work i'll make a simple setup guide for it so that others will have a easier way of setting it all up.

Kind Regards,
Battle On

Jita Exiles Productions is RECRUITING

Join -JXT- Public for more information

Battle On
GoonWaffe
Goonswarm Federation
#178 - 2014-11-17 15:07:39 UTC  |  Edited by: Battle On
Oke so far i've been able to pull yapeal in using composer, setted up the database and config and managed to get the autoloading to work. Also i've tested if it worked by adding my own API key into the utilRegisteredKey table and running bin/yapeal.php in CLI and it correctly populated the database.

First, lets start with some problems i ran in to along the way:

First of all, when fetching with composer, it gives an error that "dragonrun1/file_path_normalizer" cannot be found in packagist. Probably because the version changed or something. I'd suggest looking into this. It's easily fixable by pulling it in manually, but it would be nice if it was included in de dependancy of yapeal.

Secondly, I had a hard time setting up the autoloading. In the tutorials i could find there was a UtilRegisteredKey class, which uses a keyid as parameter for its constructor, which was used for adding keys to the database. However, in 2.0.0, this class is nowhere to be found. Instead there is the bin/UtilRegisterKey class which needs and instance of PDO and in instance of CommenSqlQueries. However, i have no idea how to set these two up, since im not familliar with PDO (I'm used to using mysqli, or use a framework like Laravel which comes with eloquent, which handles everything for me) nor the CommenSqlQueries class.

The third problem i ran in to, after i manually created the PDO and CommonSqlQueries instances, was that in the class bin/UtilRegisteredKey.php under the save(), it tries to use the table {prefix}utilRegisterKey. However, that table doesnt exist anymore, and i assume its suppose to be utilRegisteredKey. After manually changing it, it works. I'll shoot it in as an issue, since it clearly needs to be updated in github, since its in the package classes itself.

Furthermore, it would be nice to have some kind of helper class/method that can give you these two instances based on the yapeal.yaml config file that you used earlier. This way, yapeal can live completely on its own without the user needing to make an own instance of PDO and such, but only needs to add the keys he needs and populate the database using bin/yapeal.php.

I dont know if you already have such class or method, i looked through the files and couldnt find anything like it. If you have, or have some example code how to make those instances yourself, that would be very helpful!

Kind Regards,
Battle On

EDIT: found a few more things to note (see 3rd issue)

Jita Exiles Productions is RECRUITING

Join -JXT- Public for more information

Dragonaire
Here there be Dragons
#179 - 2014-11-17 20:23:30 UTC  |  Edited by: Dragonaire
Battle On - https://github.com/Dragonrun1/yapeal/issues/82 - fixed

Quote:
First of all, when fetching with composer, it gives an error that "dragonrun1/file_path_normalizer" cannot be found in packagist. Probably because the version changed or something. I'd suggest looking into this. It's easily fixable by pulling it in manually, but it would be nice if it was included in de dependancy of yapeal.


Think it was because I was working on that class yesterday and did several commits in short order etc so it should be working right now. If it still seems to be giving trouble try deleting the composer.lock file and use
composer update -o
to have it recreate it. also worth having something like the include_once - die block from bin/bootstrap.php in your own code to take advantage of the great PSR-0/PSR-4 auto class loader that composer generates for you. I found the code some where in another composer package and added a few improvements/tweaks to it as well. You should be able to just drop it some where in your project and it'll manage finding the autoloader and than you don't have to worry about doing any more includes for classes etc.

Quote:
Instead there is the bin/UtilRegisterKey class which needs and instance of PDO and in instance of CommenSqlQueries. However, i have no idea how to set these two up, since im not familliar with PDO (I'm used to using mysqli, or use a framework like Laravel which comes with eloquent, which handles everything for me) nor the CommenSqlQueries class.


CommonSqlQueries you'll find in lib/Database/ and is just a simple class I use to collect up all the SQL queries into. Just pass it the database name and table prefix you are using in the constructor. PDO isn't really that much different from mysqli and is probably what Laravel uses as well internally. I would suggest learning to use it instead of mysqli as in some future version of PHP mysqli is going away plus the PDO prepare statements, if used, can go a long ways towards preventing DB injections which is near impossible without a lot of code with mysqli. If you have a look in lib/Configuration/Wiring::wireDatabase() and ::wireDefaults() you can see how PDO is setup normally in Yapeal but utilRegisterKey takes care of it's own init stuff so you just need to give it an active PDO and it'll take it from there.

Quote:
Furthermore, it would be nice to have some kind of helper class/method that can give you these two instances based on the yapeal.yaml config file that you used earlier. This way, yapeal can live completely on its own without the user needing to make an own instance of PDO and such, but only needs to add the keys he needs and populate the database using bin/yapeal.php.


That already exists it's called lib/Yapeal.php. It was made to be extended as needed and used. Its only requirement is a working autoloader and a ContainerInterface compatible class. You can find info on the interface and the default class that Yapeal uses in lib/Container/PimpleContainer. It's basically a wrapper around Pimple 2.0 which you can find in subtree/Pimple/. I use a git subtree for Pimple instead of through Composer because most things are still using version 1.x and Composer errors out on the conflict when I do. You might also look at bin/yc and the lib/Console/Command classes to see some possible less complex ways to do things like reading yapeal.yaml and DB setup stuff. You should find that extending the Yapeal class is really easy as all the walking APIs stuff in contained in autoMagic() and can be ignored if you don't need it and just add your own methods to it for what you need. You will probably want to look at how autoMagic() grabs the DB info, calls the per API classes etc. I did a 10 minute quick example of how part of a signup check and registering might look like which you can find here that I made to show extending the Yapeal class. Maybe it'll give you some ideas how to do what you are trying to do.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Battle On
GoonWaffe
Goonswarm Federation
#180 - 2014-11-19 19:36:14 UTC
Ty for the helpful example, this makes things alot more clearer.
I've just started from scratch again and saw that you could have a config folder witin the root of you application.
However, it doesnt detect the yapeal.yaml file i have in there. I'm using a fresh install of laravel so my directory structure looks like this:

laravel/
__app/
__config/
____yapeal.yaml
__bootstrap/
__public/
__vendor/
____composer/
____yapeal/
______yapeal/
________config/
__________yapeal.yaml
____autoload.php

pretty much how its descriped in README.md. However, it doesnt wanna use the yapeal.yaml file thats in laravel/config/yapeal.yaml

Is this feature no longer supported or is this a clear bug?

Jita Exiles Productions is RECRUITING

Join -JXT- Public for more information