PHP Github API: Get repository informations - php

I'm building a page to show some specific repositories. The informations I need to know is the author, the description and the current version. Sure, I could crawl the github repository page and find the div with this information, but if Github changes the HTML my crawler would be usless. So I'm searching a official method to get this informations with PHP. Is there a solution out there for this case? I am using symfony.
Many thanks.

Git hub provides a large set of APIs. You can use them and explore the github related information for your account.
https://developer.github.com/v3/

Related

send message to Wechat users in PHP or Laravel

I want to send my customer bills to their wechat using my site (Laravel).
I have searched the API but I'm confused.
Could anyone please give me a roadmap to do this?
Well, Wechat use JSSDK framework for their API. I am not an expert at that area but the few resources that seems helpful are
Blog explaining JSSDK and how to develop API for it.
https://blog.shanghaicoders.com/how-to-set-up-wechat-js-sdk-efc773c43c1e
Git Repo with an example but with not so much details
Github Repo 31ten/wechat tuto
I hope this gives you a head start.

Google API PHP client with Composer

I made a WP plugin which depends on the Youtube API. So, to do it well, I use Google API PHP client.
My issue is quite simple: the Google API PHP client is huge (more than 12 000 files), including clients for all Google services, when I just need to use Youtube service. So I'm not confortable committing all those files to the WP plugins repo when most of them are useless in my case.
So, right now, my composer.json looks like this:
{
"require": {
"google/apiclient": "^2.0"
}
}
Any way to use only the Youtube API client (using composer if it's possible)?
This is not for the feign of heart but it is doable.
Go to this branch of the repo https://github.com/google/google-api-php-client/tree/v1-master
Grab the full src/Google directory you will need all of that.
In the src/Google/Service directory is the stuff for all the different APIs. Remove everything except for YouTube.
cross your fingers it should work.
This wont remove all 12000 files but it should give you just what you absolutely need. I used to do this but its been a few years.
Unfortunately, I don't think this is possible without manually including the relevant files in your project (which is a really bad idea).
The reason why its impossible, is because Google places all service APIs for the PHP library in a single GitHub repository found here:
https://github.com/google/google-api-php-client-services
If Google does split them into multiple repositories, then it could be possible to include a single repo.
For now, though, all services are under one composer project and one repo. Maybe its worth making a GitHub issue to ask Google about this?

How do I get all public GitHub repo that are PHP using GitHub API?

I found this link that shows me how to get all repositories using GitHub API.
http://developer.github.com/v3/repos/#list-all-repositories
But I am not sure how to find all the repositories that are PHP.
For e.g. this gives us only a select snapshot. https://github.com/trending?l=php
If this is a limit to how many repositories I can find out, I prefer to get at least 500 of the PHP repositories with the most stargazers.
After that, I would like to get a list of the stargazers and contributors of each repository.
How do I accomplish this using the GitHub API?
I am studying the network effects of these repositories so I need the above raw data.
You can use Search for that. Here's how you can do it using search on github.com (using the Advanced Search form):
https://github.com/search?l=PHP&o=desc&q=stars%3A%3E%3D0&s=stars&type=Repositories
And here's the API equivalent (using the Search API):
https://api.github.com/search/repositories?q=language:php&sort=stars
However, notice that the Search API returns only the top 1000 results and the total count. You could get around that restriction by slicing your search API query into multiple calls based on the time that the repositories were created.
After getting all repositories, you can use the Starring API to get a list of stargazers, and the Contributors API to get the list of contributors.
Also, you might be interested in the (Unofficial) GitHub Archive project which tracks, saves and exposes events from the public GitHub timeline.

Generating API documents in Git Workflow

Not sure if this should be here or on Programmers.
Generating API documents
I would like some advice on how I should generate API documentation for an internal project. I am relatively new to Git and we are trying to implement some sound build/deploying practices.
One of the things we discussed was making sure our code base is well documented and generating documentation using something like PhpDocumentor2 or one of the many similar tools.
We have started to implement a workflow similar to the one detailed here.
Should I automate when the docs are built?
For example a pre or post commit hook in git when tagging a release. Or should when I merge develop to a release branch just manually create the docs and commit to the repository?
Is it standard practice to have docs generated for each release?
I might have misunderstood the process, should a new doc release correlate with a git release/tag?
Where do you store the generated docs?
In the same repository? a different repository? Hosted somewhere like Read The Docs or just internally?
The current project we are working on is only small, but we would like to roll out the process to other larger projects in the future if successful.
Context
The project is a Magento extension which we would like to provide API docs, unit testing, and PSR conforming code. I am lacking information on how the whole workflow integrates. PHPunit and PHPDocumentor2 are installed locally via Composer.
I have heard and looked at Travis Ci, but I'm not sure if Docs fall in to that category.
This question may seem petty and/or trivial, however, I've not much experience in integration and git workflow and I couldn't find much information around.
Generated documented generally are:
always in sync with the code source (so the question of "should a new doc release correlate with a git release/tag" becomes moot)
not stored in a version control referential (like a git repo), but rather (re-)generated at will (in any location you like).
If you look at a project with a large code source, and an extensive code documentation, you can take as an example the language Go and his repository (a mercurial repo, but you have mirror on GitHub as well)
static documentations like the specs, articles, release notes, ... are kepts within the repo, as they are not generated, but updated manually, and are tightly linked to the sources.
Code documentation is kept separately in a static web site.
Documentation for all go project is kept in a static website GoDoc, which will fetch the sources of Go projects, and generate the documentation from them.

Pull changes and merge files from github using php?

I am looking at setting up a blog for all my plugins. All the plugins are hosted oh github.
because each plugin has all the information I would want to show in my blog already I want to try generating my blog pages automatically (and the demo pages for the plugins). I know how to setup post-receive hooks to get A ping when the repo gets pushed to. And I could download the entire zip of that repo but I am wondering if there is a more elegant way and was looking at pulling just the changes and merging them. Is this possible with php?
Maybe Git.php can do what you need.
Have you Googled for a PHP+Git library? I did and found this: PHP Git, and this git-php.

Categories