An API for connecting to the Joshua Project data. It uses the PHP Slim Framework.
This repository is following the branching technique described in this blog post, and the semantic version set out on the Semantic Versioning Website.
This tool uses Composer to install the project specific libraries. We also use Swagger annotations for generating the front facing API documentation.
Questions or problems? Please post them on the issue tracker. You can contribute changes by forking the project and submitting a pull request.
Here are details for setting up your own local instance of the repository.
Before starting, ensure you have the following software installed on your system:
- Docker
- Download and install Docker for your operating system.
- Windows users must enable WSL2 integration.
- Docker Compose
- Docker Compose is included with Docker Desktop for macOS and Windows. Verify its installation by running in a terminal:
docker-compose --version
- Docker Compose is included with Docker Desktop for macOS and Windows. Verify its installation by running in a terminal:
You also need to collect some files from the client. These files include a zip archive of the uploads & plugins directory, as well as, a database dump of the current site content.
If you would like to set up this code locally, you will need to follow these steps:
- Clone the repository to your machine
- Change to the root directory of the project
- Copy the file
.env.exampleto.env. You do not need to change any of the settings. - Copy the file
Public/.htaccess.exampletoPublic/.htaccess. - Copy the database file to _docker/database/data/. You may need to request a copy of the database from our team.
- If you are on the latest Mac, you should open the docker-compose.yml file, and comment out
platform: linux/x86_64on each container. - Start up Docker Desktop.
- On Terminal, in the root directory of the code, run
docker compose build --no-cache - After it completes, get the containers running with the following command:
docker compose up -d - Now install the dependencies using this command:
docker exec -it jp_api_php composer install - If everything ran successfully, you can open your browser and visit http://localhost:8080/.
To deploy this code, simply follow these steps:
- Clone the code to your server.
- Copy the file
.env.exampleto.env. - Open the file, and set the appropriate settings.
- Install Composer on your server.
- Install all the required librarues with
composer install.
In your php.ini file you will need to set the following values equal to or greater than the value provided:
- max_execution_time = 90
Sample code for PHP, Ruby, Javascript and Python can be found in the following Github Repo.
To set up the Google Analytics, you need to do the following in Google Analytics:
- Add a data stream: Admin > Data Streams > Add a Stream
- Get the Measurement ID
- To get the secret: Admin > Data Streams > Click the appropriate stream
- Click Measurement Protocol API Secrets
- Create
- Copy the key
- Add the event: Admin > Events > Create Event api_requests
- Add custom definitions:
- Admin > Custom Definitions
- Create 3 Custom Dimensions: endpoint, format, version
Add your settings to the .env file, and in 24 hours you should start receiving data.
This script is created by Missional Digerati and is under the GNU General Public License v3.