{"id":22487824,"url":"https://github.com/WeLikeGraphQL/wordpress-graphql-api-example","last_synced_at":"2025-08-02T20:31:46.777Z","repository":{"id":123649142,"uuid":"69590467","full_name":"WeLikeGraphQL/wordpress-graphql-api-example","owner":"WeLikeGraphQL","description":"GraphQL API example in Wordpress","archived":false,"fork":false,"pushed_at":"2016-10-22T11:06:07.000Z","size":9236,"stargazers_count":36,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T15:24:12.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WeLikeGraphQL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-29T17:21:07.000Z","updated_at":"2022-11-11T12:32:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"83ab85e1-234d-431d-835f-f9fa8f46b57b","html_url":"https://github.com/WeLikeGraphQL/wordpress-graphql-api-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WeLikeGraphQL/wordpress-graphql-api-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeLikeGraphQL%2Fwordpress-graphql-api-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeLikeGraphQL%2Fwordpress-graphql-api-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeLikeGraphQL%2Fwordpress-graphql-api-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeLikeGraphQL%2Fwordpress-graphql-api-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WeLikeGraphQL","download_url":"https://codeload.github.com/WeLikeGraphQL/wordpress-graphql-api-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeLikeGraphQL%2Fwordpress-graphql-api-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268448362,"owners_count":24252019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-06T17:17:17.252Z","updated_at":"2025-08-02T20:31:46.724Z","avatar_url":"https://github.com/WeLikeGraphQL.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# wordpress-graphql-api-example\n\n\u003eThe aim of this repo is to give an example of publishing [GraphQL](http://graphql.org/) API in [Wordpress](https://wordpress.org/download/).\n\n[Here](https://github.com/WeLikeGraphQL/react-apollo-example) is the app that consumes this API.\n\n## Execution\n\nThe project can be run using one of the following (what is convenient for you):\n\n**[Vagrant](https://www.vagrantup.com/)** - for one-command virtual machine provisioning in Windows, Linux, OSX... (the best option when Ansible/Docker not installed). Requirements: *Vagrant \u003e=1.8*\n \n**[Ansible](https://www.ansible.com/)** - for one-command own host provisioning and containerizing the app in Linux (the best option when Docker not installed). Requirements: *ansible-playbook*\n \n**[Docker](https://www.docker.com/)** - for containerizing the app in Linux. Requirements: *docker*, *docker-compose*, *[local-persist](https://github.com/CWSpear/local-persist)*\n \n**Manually** - (any OS, required Apache2/Nginx, PHP \u003e= 5.6, MySQL, [Composer](https://getcomposer.org/) etc.)\n\n**We give you a lot of installation options, because we assume that not every developer will come from PHP World and have already installed all needed stuff for manual set-up. If you are not interested in the backend part, just choose the simplest way of installation and run the [Web App](https://github.com/WeLikeGraphQL/react-apollo-example), which consumes this Wordpress GraphQL API.**\n\nThe project publishes the following endpoints:\n - `localhost:8000/graphql` - GraphQL API Endpoint\n - `localhost:8888` - PhpMyAdmin\n\nYou can customize data in `.env` file.\n\n### Vagrant (for Windows, Linux, OSX)\n\nVagrant makes the project executable in Windows, Linux, OSX... (as Docker is available out-of-the-box only for [some Linux instances](https://docs.docker.com/engine/installation/linux/)). So, if you want to set everything up automatically, then install [Vagrant\u003e=1.8](https://www.vagrantup.com/) and execute:\n\n - `bash -x scripts/run_vagrant.sh`\n\nIt might take some time for running the project at first, as all dependencies have to be downloaded, but it is all what you need to do to run the API. Check `localhost:8000/graphql` (if there is no 404 then ok). \n\nSample data are included automatically after every run.\n\n### Ansible (for Linux)\n\nIf you do not have Docker installed, then you can install everything using [Ansible](https://www.ansible.com/). Invoke:\n\n - `ansible-playbook -vvv main.yml`\n - `bash -x scripts/load_db.sh`\n\nIt will install and run the needed stuff on your host (now you have Docker installed and you can use in the second run). Sample data are included automatically thanks to the second command.\n\nIf you have Linux distribution that is not supported by Docker and it causes errors, then change the following part in `roles/vagrant/tasks/install.yml`:\n\n`{{ ansible_distribution|lower}}-{{ ansible_distribution_release }}`\n\nonto one of [supported distributions](https://docs.docker.com/engine/installation/linux/) (`ubuntu-trusty`, `debian-wheezy` etc.)\n\n\n\n### Docker (for Linux)\n\nYou can use [Docker Compose](https://docs.docker.com/compose/) in order to set everything up and containerize automatically. Install [local-persist](https://github.com/CWSpear/local-persist#running-outside-a-container) docker plugin and just execute:\n\n - `docker-compose up`\n - `bash -x scripts/load_db.sh`\n\nSample data are included automatically thanks to the second command.\n\n### Manually (for Windows, Linux, OSX)\n\n - `cd wordpress \u0026\u0026 composer install`\n - change data in `wp-config.php` according to your MySQL Server\n - `bash -x scripts/add_to_plugin.sh` (due to [this](https://github.com/tim-field/graphql-wp/pull/9))\n - copy/paste `wordpress` folder to your PHP Server\n - `cd mysql \u0026\u0026 mysql -u\u003cYOUR_USER_HERE\u003e -p\u003cYOUR_PASSWORD_HERE\u003e \u003c wp_backup.sql` (inserting sample data) Caveat: change database name in `wp_backup.sql` accordingly.\n\n## Backup\n\nIf you wish to do a database backup, then execute one of the following (depending how you set up the project):\n\n - Vagrant: `vagrant ssh` and `cd /vagrant/scripts \u0026\u0026 sudo bash -x backup.sh`\n - Ansible or Docker: `cd scripts \u0026\u0026 sudo bash -x backup.sh`\n - Manually: `cd scripts \u0026\u0026 mysqldump -h$\u003cYOUR_HOST_HERE\u003e -u$\u003cYOUR_MYSQL_USER_HERE\u003e -p$\u003cYOUR_MYSQL_PASSWORD_HERE\u003e $\u003cYOUR_MYSQL_DB_NAME\u003e \u003e wp_backup.sql`\n\n## GraphiQL\n\nIt is recommended to explore possibilities of GraphQL API Endpoint. The fastest way to do it is to use one of the following solutions:\n - [ChromeiQL](https://chrome.google.com/webstore/detail/chromeiql/fkkiamalmpiidkljmicmjfbieiclmeij)\n - [GraphIQL Feen](https://chrome.google.com/webstore/detail/graphiql-feen/mcbfdonlkfpbfdpimkjilhdneikhfklp)\n\nBut you can also set up the original tool created by GraphQL Team: [GraphiQL](https://github.com/graphql/graphiql)\n\nScreenshot from ChromeiQL:\n\n![https://raw.githubusercontent.com/balintsera/graphql-wp/fix/no-response/.readme.md/graphiql-query.png](https://raw.githubusercontent.com/balintsera/graphql-wp/fix/no-response/.readme.md/graphiql-query.png)\n\n## Acknowledgements\nThanks for @tim-field, who published his work: [graphql-wp](https://github.com/tim-field/graphql-wp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWeLikeGraphQL%2Fwordpress-graphql-api-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWeLikeGraphQL%2Fwordpress-graphql-api-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWeLikeGraphQL%2Fwordpress-graphql-api-example/lists"}