This page covers everything you need to know before running Country-Click, whether you are setting it up on a local development machine or deploying it to a shared PHP web host. The application has no database, no environment variables, and a single production dependency: a compiled Tailwind CSS file that is already committed to the repository. Most developers will be up and running after verifying their PHP configuration and starting the built-in server.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AndresLopezCorrales/Countries-WebPage/llms.txt
Use this file to discover all available pages before exploring further.
System Requirements
| Requirement | Details |
|---|---|
| PHP | 7.4 or higher |
| php.ini directive | allow_url_fopen = On (required for file_get_contents() API calls) |
| Node.js | 16 or higher — only needed when rebuilding the Tailwind CSS output |
| Internet connection | Required at runtime; all country data is fetched live from the REST Countries API |
Project Structure
The repository has a straightforward layout. The entire PHP application lives insidesrc/, and the compiled CSS is committed so no build step is required for a standard installation:
index.php— instantiatesApiConsumer, renders the navbar (including the search form), includes the full SVG world map, and calls$consumer->menu()to output the country information panel.ApiConsumer.php— orchestrates the full request lifecycle: reads the search bar POST value viasearchBar(), falls back to the map-click POST value viaGetNameController, builds the API URL (https://restcountries.com/v3.1/name/{name}), callsfile_get_contents(), decodes the JSON, delegates field extraction toGetAttributesController, and echoes the rendered HTML panel.GetAttributesController.php— provides individual getter methods for each data field:getCommonName(),getOfficialName(),getRegion(),getPopulation(),getCapital(),getLanguage(),getTimezone(), andgetFlag().GetNameController.php— reads thetituloPOST field submitted by the JavaScript map-click handler.getname.js— attaches aclickevent listener to every.countrySVG element, reads thexlink:titleattribute (the English country name), creates a hidden POST form, and submits it programmatically.
PHP Configuration
Country-Click usesfile_get_contents() to make HTTP requests to the REST Countries API:
allow_url_fopen directive to be enabled in your php.ini. Locate your active php.ini file (run php --ini to find it) and confirm or add the following line:
1 means the directive is enabled. A result of 0 means it is disabled — edit your php.ini, set allow_url_fopen = On, and restart your web server or PHP-FPM service.
Tailwind CSS Rebuild
The compiled stylesheetsrc/output.css is committed to the repository, so you do not need to rebuild CSS to run the app. A rebuild is only necessary when you modify PHP templates, HTML, or JavaScript files and introduce new Tailwind utility classes that are not yet present in the compiled output.
To perform a one-time rebuild, run the following from the project root:
--watch flag:
content glob defined in tailwind.config.js:
tailwind.config.js
brown-* color tokens are used throughout index.php for the navbar, background, text, and button styles. Any new class names you add to .php, .js, or .html files inside src/ will be picked up automatically on the next build.
Deploying to a Web Host
Country-Click has no build artifacts beyond the compiled CSS, no database schema to import, and no environment variables to configure, which makes deployment straightforward:- Upload the entire
src/directory to your web host’s public document root (typicallypublic_html/orwww/). - Confirm that your host runs PHP 7.4 or higher.
- Confirm that
allow_url_fopenis enabled — check your host’s PHP configuration panel or contact support if you are on a managed shared host. - Visit your domain in a browser. The app will be fully functional as long as the server can reach
https://restcountries.com.
There is no
.env file, no database connection string, and no server-side session storage. The only external dependency at runtime is network access to https://restcountries.com/v3.1/.