Skip to content

Examples ​

Each example is a small Nette application in examples/. Its e2e.sh starts the PHP built-in server and checks every response with curl; CI runs all of them against the current code of the library.

bash
git clone https://github.com/tomaj/nette-api.git
cd nette-api/examples/hello-world
composer install
./e2e.sh

Library version ​

The examples require tomaj/nette-api ^3.6, so composer install gets the latest 3.x release. Some of them use features added in 3.6.0, for example the masked headers in Logging and errors.

To run an example against your local checkout, as CI does, use examples/ci/example.sh hello-world from the repository root.

All examples need PHP 8.3 or newer and Composer. They use composer.json with tomaj/nette-api: ^3.6.

FAQ ​

Which example should I start with? ​

Hello world, then the one for the feature you need.

Do the examples use a database? ​

No, data are in memory or in files, so composer install is the only setup.

Can I copy an example as a starting point? ​

Yes, the config, the router and the bootstrap are a complete application. Read Getting started for what each part does.

How does CI test them? ​

examples/ci/example.sh NAME copies the project, points Composer at the checked out library and runs e2e.sh.

Which ports do they use? ​

8081 to 8087 and 8090 to 8096, one per example (logging and errors uses two), so they can run side by side.

Released under the MIT License.