├── .gitignore ├── README.md ├── composer.json ├── composer.lock ├── config ├── bootstrap.php ├── container.php ├── middleware.php ├── routes.php └── settings.php ├── public └── index.php └── src └── Action └── HomeAction.php /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | .idea/ 3 | .env -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Slim 4 Tutorial 2 | 3 | This is the source code for the Slim 4 tutorial: 4 | 5 | https://odan.github.io/2019/11/05/slim4-tutorial.html -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "nyholm/psr7": "^1", 4 | "nyholm/psr7-server": "^1", 5 | "php-di/php-di": "^7", 6 | "slim/slim": "^4" 7 | }, 8 | "autoload": { 9 | "psr-4": { 10 | "App\\": "src/" 11 | } 12 | }, 13 | "config": { 14 | "process-timeout": 0 15 | }, 16 | "scripts": { 17 | "start": "php -S localhost:8080 -t public/" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "bffb63f616a6bc7d4e8779e6861dff62", 8 | "packages": [ 9 | { 10 | "name": "laravel/serializable-closure", 11 | "version": "v1.3.3", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/laravel/serializable-closure.git", 15 | "reference": "3dbf8a8e914634c48d389c1234552666b3d43754" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3dbf8a8e914634c48d389c1234552666b3d43754", 20 | "reference": "3dbf8a8e914634c48d389c1234552666b3d43754", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": "^7.3|^8.0" 25 | }, 26 | "require-dev": { 27 | "nesbot/carbon": "^2.61", 28 | "pestphp/pest": "^1.21.3", 29 | "phpstan/phpstan": "^1.8.2", 30 | "symfony/var-dumper": "^5.4.11" 31 | }, 32 | "type": "library", 33 | "extra": { 34 | "branch-alias": { 35 | "dev-master": "1.x-dev" 36 | } 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "Laravel\\SerializableClosure\\": "src/" 41 | } 42 | }, 43 | "notification-url": "https://packagist.org/downloads/", 44 | "license": [ 45 | "MIT" 46 | ], 47 | "authors": [ 48 | { 49 | "name": "Taylor Otwell", 50 | "email": "taylor@laravel.com" 51 | }, 52 | { 53 | "name": "Nuno Maduro", 54 | "email": "nuno@laravel.com" 55 | } 56 | ], 57 | "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.", 58 | "keywords": [ 59 | "closure", 60 | "laravel", 61 | "serializable" 62 | ], 63 | "support": { 64 | "issues": "https://github.com/laravel/serializable-closure/issues", 65 | "source": "https://github.com/laravel/serializable-closure" 66 | }, 67 | "time": "2023-11-08T14:08:06+00:00" 68 | }, 69 | { 70 | "name": "nikic/fast-route", 71 | "version": "v1.3.0", 72 | "source": { 73 | "type": "git", 74 | "url": "https://github.com/nikic/FastRoute.git", 75 | "reference": "181d480e08d9476e61381e04a71b34dc0432e812" 76 | }, 77 | "dist": { 78 | "type": "zip", 79 | "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", 80 | "reference": "181d480e08d9476e61381e04a71b34dc0432e812", 81 | "shasum": "" 82 | }, 83 | "require": { 84 | "php": ">=5.4.0" 85 | }, 86 | "require-dev": { 87 | "phpunit/phpunit": "^4.8.35|~5.7" 88 | }, 89 | "type": "library", 90 | "autoload": { 91 | "files": [ 92 | "src/functions.php" 93 | ], 94 | "psr-4": { 95 | "FastRoute\\": "src/" 96 | } 97 | }, 98 | "notification-url": "https://packagist.org/downloads/", 99 | "license": [ 100 | "BSD-3-Clause" 101 | ], 102 | "authors": [ 103 | { 104 | "name": "Nikita Popov", 105 | "email": "nikic@php.net" 106 | } 107 | ], 108 | "description": "Fast request router for PHP", 109 | "keywords": [ 110 | "router", 111 | "routing" 112 | ], 113 | "support": { 114 | "issues": "https://github.com/nikic/FastRoute/issues", 115 | "source": "https://github.com/nikic/FastRoute/tree/master" 116 | }, 117 | "time": "2018-02-13T20:26:39+00:00" 118 | }, 119 | { 120 | "name": "nyholm/psr7", 121 | "version": "1.8.1", 122 | "source": { 123 | "type": "git", 124 | "url": "https://github.com/Nyholm/psr7.git", 125 | "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e" 126 | }, 127 | "dist": { 128 | "type": "zip", 129 | "url": "https://api.github.com/repos/Nyholm/psr7/zipball/aa5fc277a4f5508013d571341ade0c3886d4d00e", 130 | "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e", 131 | "shasum": "" 132 | }, 133 | "require": { 134 | "php": ">=7.2", 135 | "psr/http-factory": "^1.0", 136 | "psr/http-message": "^1.1 || ^2.0" 137 | }, 138 | "provide": { 139 | "php-http/message-factory-implementation": "1.0", 140 | "psr/http-factory-implementation": "1.0", 141 | "psr/http-message-implementation": "1.0" 142 | }, 143 | "require-dev": { 144 | "http-interop/http-factory-tests": "^0.9", 145 | "php-http/message-factory": "^1.0", 146 | "php-http/psr7-integration-tests": "^1.0", 147 | "phpunit/phpunit": "^7.5 || ^8.5 || ^9.4", 148 | "symfony/error-handler": "^4.4" 149 | }, 150 | "type": "library", 151 | "extra": { 152 | "branch-alias": { 153 | "dev-master": "1.8-dev" 154 | } 155 | }, 156 | "autoload": { 157 | "psr-4": { 158 | "Nyholm\\Psr7\\": "src/" 159 | } 160 | }, 161 | "notification-url": "https://packagist.org/downloads/", 162 | "license": [ 163 | "MIT" 164 | ], 165 | "authors": [ 166 | { 167 | "name": "Tobias Nyholm", 168 | "email": "tobias.nyholm@gmail.com" 169 | }, 170 | { 171 | "name": "Martijn van der Ven", 172 | "email": "martijn@vanderven.se" 173 | } 174 | ], 175 | "description": "A fast PHP7 implementation of PSR-7", 176 | "homepage": "https://tnyholm.se", 177 | "keywords": [ 178 | "psr-17", 179 | "psr-7" 180 | ], 181 | "support": { 182 | "issues": "https://github.com/Nyholm/psr7/issues", 183 | "source": "https://github.com/Nyholm/psr7/tree/1.8.1" 184 | }, 185 | "funding": [ 186 | { 187 | "url": "https://github.com/Zegnat", 188 | "type": "github" 189 | }, 190 | { 191 | "url": "https://github.com/nyholm", 192 | "type": "github" 193 | } 194 | ], 195 | "time": "2023-11-13T09:31:12+00:00" 196 | }, 197 | { 198 | "name": "nyholm/psr7-server", 199 | "version": "1.1.0", 200 | "source": { 201 | "type": "git", 202 | "url": "https://github.com/Nyholm/psr7-server.git", 203 | "reference": "4335801d851f554ca43fa6e7d2602141538854dc" 204 | }, 205 | "dist": { 206 | "type": "zip", 207 | "url": "https://api.github.com/repos/Nyholm/psr7-server/zipball/4335801d851f554ca43fa6e7d2602141538854dc", 208 | "reference": "4335801d851f554ca43fa6e7d2602141538854dc", 209 | "shasum": "" 210 | }, 211 | "require": { 212 | "php": "^7.1 || ^8.0", 213 | "psr/http-factory": "^1.0", 214 | "psr/http-message": "^1.0 || ^2.0" 215 | }, 216 | "require-dev": { 217 | "nyholm/nsa": "^1.1", 218 | "nyholm/psr7": "^1.3", 219 | "phpunit/phpunit": "^7.0 || ^8.5 || ^9.3" 220 | }, 221 | "type": "library", 222 | "autoload": { 223 | "psr-4": { 224 | "Nyholm\\Psr7Server\\": "src/" 225 | } 226 | }, 227 | "notification-url": "https://packagist.org/downloads/", 228 | "license": [ 229 | "MIT" 230 | ], 231 | "authors": [ 232 | { 233 | "name": "Tobias Nyholm", 234 | "email": "tobias.nyholm@gmail.com" 235 | }, 236 | { 237 | "name": "Martijn van der Ven", 238 | "email": "martijn@vanderven.se" 239 | } 240 | ], 241 | "description": "Helper classes to handle PSR-7 server requests", 242 | "homepage": "http://tnyholm.se", 243 | "keywords": [ 244 | "psr-17", 245 | "psr-7" 246 | ], 247 | "support": { 248 | "issues": "https://github.com/Nyholm/psr7-server/issues", 249 | "source": "https://github.com/Nyholm/psr7-server/tree/1.1.0" 250 | }, 251 | "funding": [ 252 | { 253 | "url": "https://github.com/Zegnat", 254 | "type": "github" 255 | }, 256 | { 257 | "url": "https://github.com/nyholm", 258 | "type": "github" 259 | } 260 | ], 261 | "time": "2023-11-08T09:30:43+00:00" 262 | }, 263 | { 264 | "name": "php-di/invoker", 265 | "version": "2.3.4", 266 | "source": { 267 | "type": "git", 268 | "url": "https://github.com/PHP-DI/Invoker.git", 269 | "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86" 270 | }, 271 | "dist": { 272 | "type": "zip", 273 | "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/33234b32dafa8eb69202f950a1fc92055ed76a86", 274 | "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86", 275 | "shasum": "" 276 | }, 277 | "require": { 278 | "php": ">=7.3", 279 | "psr/container": "^1.0|^2.0" 280 | }, 281 | "require-dev": { 282 | "athletic/athletic": "~0.1.8", 283 | "mnapoli/hard-mode": "~0.3.0", 284 | "phpunit/phpunit": "^9.0" 285 | }, 286 | "type": "library", 287 | "autoload": { 288 | "psr-4": { 289 | "Invoker\\": "src/" 290 | } 291 | }, 292 | "notification-url": "https://packagist.org/downloads/", 293 | "license": [ 294 | "MIT" 295 | ], 296 | "description": "Generic and extensible callable invoker", 297 | "homepage": "https://github.com/PHP-DI/Invoker", 298 | "keywords": [ 299 | "callable", 300 | "dependency", 301 | "dependency-injection", 302 | "injection", 303 | "invoke", 304 | "invoker" 305 | ], 306 | "support": { 307 | "issues": "https://github.com/PHP-DI/Invoker/issues", 308 | "source": "https://github.com/PHP-DI/Invoker/tree/2.3.4" 309 | }, 310 | "funding": [ 311 | { 312 | "url": "https://github.com/mnapoli", 313 | "type": "github" 314 | } 315 | ], 316 | "time": "2023-09-08T09:24:21+00:00" 317 | }, 318 | { 319 | "name": "php-di/php-di", 320 | "version": "7.0.6", 321 | "source": { 322 | "type": "git", 323 | "url": "https://github.com/PHP-DI/PHP-DI.git", 324 | "reference": "8097948a89f6ec782839b3e958432f427cac37fd" 325 | }, 326 | "dist": { 327 | "type": "zip", 328 | "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/8097948a89f6ec782839b3e958432f427cac37fd", 329 | "reference": "8097948a89f6ec782839b3e958432f427cac37fd", 330 | "shasum": "" 331 | }, 332 | "require": { 333 | "laravel/serializable-closure": "^1.0", 334 | "php": ">=8.0", 335 | "php-di/invoker": "^2.0", 336 | "psr/container": "^1.1 || ^2.0" 337 | }, 338 | "provide": { 339 | "psr/container-implementation": "^1.0" 340 | }, 341 | "require-dev": { 342 | "friendsofphp/php-cs-fixer": "^3", 343 | "friendsofphp/proxy-manager-lts": "^1", 344 | "mnapoli/phpunit-easymock": "^1.3", 345 | "phpunit/phpunit": "^9.5", 346 | "vimeo/psalm": "^4.6" 347 | }, 348 | "suggest": { 349 | "friendsofphp/proxy-manager-lts": "Install it if you want to use lazy injection (version ^1)" 350 | }, 351 | "type": "library", 352 | "autoload": { 353 | "files": [ 354 | "src/functions.php" 355 | ], 356 | "psr-4": { 357 | "DI\\": "src/" 358 | } 359 | }, 360 | "notification-url": "https://packagist.org/downloads/", 361 | "license": [ 362 | "MIT" 363 | ], 364 | "description": "The dependency injection container for humans", 365 | "homepage": "https://php-di.org/", 366 | "keywords": [ 367 | "PSR-11", 368 | "container", 369 | "container-interop", 370 | "dependency injection", 371 | "di", 372 | "ioc", 373 | "psr11" 374 | ], 375 | "support": { 376 | "issues": "https://github.com/PHP-DI/PHP-DI/issues", 377 | "source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.6" 378 | }, 379 | "funding": [ 380 | { 381 | "url": "https://github.com/mnapoli", 382 | "type": "github" 383 | }, 384 | { 385 | "url": "https://tidelift.com/funding/github/packagist/php-di/php-di", 386 | "type": "tidelift" 387 | } 388 | ], 389 | "time": "2023-11-02T10:04:50+00:00" 390 | }, 391 | { 392 | "name": "psr/container", 393 | "version": "2.0.2", 394 | "source": { 395 | "type": "git", 396 | "url": "https://github.com/php-fig/container.git", 397 | "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" 398 | }, 399 | "dist": { 400 | "type": "zip", 401 | "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", 402 | "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", 403 | "shasum": "" 404 | }, 405 | "require": { 406 | "php": ">=7.4.0" 407 | }, 408 | "type": "library", 409 | "extra": { 410 | "branch-alias": { 411 | "dev-master": "2.0.x-dev" 412 | } 413 | }, 414 | "autoload": { 415 | "psr-4": { 416 | "Psr\\Container\\": "src/" 417 | } 418 | }, 419 | "notification-url": "https://packagist.org/downloads/", 420 | "license": [ 421 | "MIT" 422 | ], 423 | "authors": [ 424 | { 425 | "name": "PHP-FIG", 426 | "homepage": "https://www.php-fig.org/" 427 | } 428 | ], 429 | "description": "Common Container Interface (PHP FIG PSR-11)", 430 | "homepage": "https://github.com/php-fig/container", 431 | "keywords": [ 432 | "PSR-11", 433 | "container", 434 | "container-interface", 435 | "container-interop", 436 | "psr" 437 | ], 438 | "support": { 439 | "issues": "https://github.com/php-fig/container/issues", 440 | "source": "https://github.com/php-fig/container/tree/2.0.2" 441 | }, 442 | "time": "2021-11-05T16:47:00+00:00" 443 | }, 444 | { 445 | "name": "psr/http-factory", 446 | "version": "1.0.2", 447 | "source": { 448 | "type": "git", 449 | "url": "https://github.com/php-fig/http-factory.git", 450 | "reference": "e616d01114759c4c489f93b099585439f795fe35" 451 | }, 452 | "dist": { 453 | "type": "zip", 454 | "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", 455 | "reference": "e616d01114759c4c489f93b099585439f795fe35", 456 | "shasum": "" 457 | }, 458 | "require": { 459 | "php": ">=7.0.0", 460 | "psr/http-message": "^1.0 || ^2.0" 461 | }, 462 | "type": "library", 463 | "extra": { 464 | "branch-alias": { 465 | "dev-master": "1.0.x-dev" 466 | } 467 | }, 468 | "autoload": { 469 | "psr-4": { 470 | "Psr\\Http\\Message\\": "src/" 471 | } 472 | }, 473 | "notification-url": "https://packagist.org/downloads/", 474 | "license": [ 475 | "MIT" 476 | ], 477 | "authors": [ 478 | { 479 | "name": "PHP-FIG", 480 | "homepage": "https://www.php-fig.org/" 481 | } 482 | ], 483 | "description": "Common interfaces for PSR-7 HTTP message factories", 484 | "keywords": [ 485 | "factory", 486 | "http", 487 | "message", 488 | "psr", 489 | "psr-17", 490 | "psr-7", 491 | "request", 492 | "response" 493 | ], 494 | "support": { 495 | "source": "https://github.com/php-fig/http-factory/tree/1.0.2" 496 | }, 497 | "time": "2023-04-10T20:10:41+00:00" 498 | }, 499 | { 500 | "name": "psr/http-message", 501 | "version": "1.1", 502 | "source": { 503 | "type": "git", 504 | "url": "https://github.com/php-fig/http-message.git", 505 | "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" 506 | }, 507 | "dist": { 508 | "type": "zip", 509 | "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", 510 | "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", 511 | "shasum": "" 512 | }, 513 | "require": { 514 | "php": "^7.2 || ^8.0" 515 | }, 516 | "type": "library", 517 | "extra": { 518 | "branch-alias": { 519 | "dev-master": "1.1.x-dev" 520 | } 521 | }, 522 | "autoload": { 523 | "psr-4": { 524 | "Psr\\Http\\Message\\": "src/" 525 | } 526 | }, 527 | "notification-url": "https://packagist.org/downloads/", 528 | "license": [ 529 | "MIT" 530 | ], 531 | "authors": [ 532 | { 533 | "name": "PHP-FIG", 534 | "homepage": "http://www.php-fig.org/" 535 | } 536 | ], 537 | "description": "Common interface for HTTP messages", 538 | "homepage": "https://github.com/php-fig/http-message", 539 | "keywords": [ 540 | "http", 541 | "http-message", 542 | "psr", 543 | "psr-7", 544 | "request", 545 | "response" 546 | ], 547 | "support": { 548 | "source": "https://github.com/php-fig/http-message/tree/1.1" 549 | }, 550 | "time": "2023-04-04T09:50:52+00:00" 551 | }, 552 | { 553 | "name": "psr/http-server-handler", 554 | "version": "1.0.2", 555 | "source": { 556 | "type": "git", 557 | "url": "https://github.com/php-fig/http-server-handler.git", 558 | "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" 559 | }, 560 | "dist": { 561 | "type": "zip", 562 | "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", 563 | "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", 564 | "shasum": "" 565 | }, 566 | "require": { 567 | "php": ">=7.0", 568 | "psr/http-message": "^1.0 || ^2.0" 569 | }, 570 | "type": "library", 571 | "extra": { 572 | "branch-alias": { 573 | "dev-master": "1.0.x-dev" 574 | } 575 | }, 576 | "autoload": { 577 | "psr-4": { 578 | "Psr\\Http\\Server\\": "src/" 579 | } 580 | }, 581 | "notification-url": "https://packagist.org/downloads/", 582 | "license": [ 583 | "MIT" 584 | ], 585 | "authors": [ 586 | { 587 | "name": "PHP-FIG", 588 | "homepage": "https://www.php-fig.org/" 589 | } 590 | ], 591 | "description": "Common interface for HTTP server-side request handler", 592 | "keywords": [ 593 | "handler", 594 | "http", 595 | "http-interop", 596 | "psr", 597 | "psr-15", 598 | "psr-7", 599 | "request", 600 | "response", 601 | "server" 602 | ], 603 | "support": { 604 | "source": "https://github.com/php-fig/http-server-handler/tree/1.0.2" 605 | }, 606 | "time": "2023-04-10T20:06:20+00:00" 607 | }, 608 | { 609 | "name": "psr/http-server-middleware", 610 | "version": "1.0.2", 611 | "source": { 612 | "type": "git", 613 | "url": "https://github.com/php-fig/http-server-middleware.git", 614 | "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" 615 | }, 616 | "dist": { 617 | "type": "zip", 618 | "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", 619 | "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", 620 | "shasum": "" 621 | }, 622 | "require": { 623 | "php": ">=7.0", 624 | "psr/http-message": "^1.0 || ^2.0", 625 | "psr/http-server-handler": "^1.0" 626 | }, 627 | "type": "library", 628 | "extra": { 629 | "branch-alias": { 630 | "dev-master": "1.0.x-dev" 631 | } 632 | }, 633 | "autoload": { 634 | "psr-4": { 635 | "Psr\\Http\\Server\\": "src/" 636 | } 637 | }, 638 | "notification-url": "https://packagist.org/downloads/", 639 | "license": [ 640 | "MIT" 641 | ], 642 | "authors": [ 643 | { 644 | "name": "PHP-FIG", 645 | "homepage": "https://www.php-fig.org/" 646 | } 647 | ], 648 | "description": "Common interface for HTTP server-side middleware", 649 | "keywords": [ 650 | "http", 651 | "http-interop", 652 | "middleware", 653 | "psr", 654 | "psr-15", 655 | "psr-7", 656 | "request", 657 | "response" 658 | ], 659 | "support": { 660 | "issues": "https://github.com/php-fig/http-server-middleware/issues", 661 | "source": "https://github.com/php-fig/http-server-middleware/tree/1.0.2" 662 | }, 663 | "time": "2023-04-11T06:14:47+00:00" 664 | }, 665 | { 666 | "name": "psr/log", 667 | "version": "3.0.0", 668 | "source": { 669 | "type": "git", 670 | "url": "https://github.com/php-fig/log.git", 671 | "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" 672 | }, 673 | "dist": { 674 | "type": "zip", 675 | "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", 676 | "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", 677 | "shasum": "" 678 | }, 679 | "require": { 680 | "php": ">=8.0.0" 681 | }, 682 | "type": "library", 683 | "extra": { 684 | "branch-alias": { 685 | "dev-master": "3.x-dev" 686 | } 687 | }, 688 | "autoload": { 689 | "psr-4": { 690 | "Psr\\Log\\": "src" 691 | } 692 | }, 693 | "notification-url": "https://packagist.org/downloads/", 694 | "license": [ 695 | "MIT" 696 | ], 697 | "authors": [ 698 | { 699 | "name": "PHP-FIG", 700 | "homepage": "https://www.php-fig.org/" 701 | } 702 | ], 703 | "description": "Common interface for logging libraries", 704 | "homepage": "https://github.com/php-fig/log", 705 | "keywords": [ 706 | "log", 707 | "psr", 708 | "psr-3" 709 | ], 710 | "support": { 711 | "source": "https://github.com/php-fig/log/tree/3.0.0" 712 | }, 713 | "time": "2021-07-14T16:46:02+00:00" 714 | }, 715 | { 716 | "name": "slim/slim", 717 | "version": "4.12.0", 718 | "source": { 719 | "type": "git", 720 | "url": "https://github.com/slimphp/Slim.git", 721 | "reference": "e9e99c2b24398b967841c6c4c3048622cc7e2b18" 722 | }, 723 | "dist": { 724 | "type": "zip", 725 | "url": "https://api.github.com/repos/slimphp/Slim/zipball/e9e99c2b24398b967841c6c4c3048622cc7e2b18", 726 | "reference": "e9e99c2b24398b967841c6c4c3048622cc7e2b18", 727 | "shasum": "" 728 | }, 729 | "require": { 730 | "ext-json": "*", 731 | "nikic/fast-route": "^1.3", 732 | "php": "^7.4 || ^8.0", 733 | "psr/container": "^1.0 || ^2.0", 734 | "psr/http-factory": "^1.0", 735 | "psr/http-message": "^1.1", 736 | "psr/http-server-handler": "^1.0", 737 | "psr/http-server-middleware": "^1.0", 738 | "psr/log": "^1.1 || ^2.0 || ^3.0" 739 | }, 740 | "require-dev": { 741 | "adriansuter/php-autoload-override": "^1.4", 742 | "ext-simplexml": "*", 743 | "guzzlehttp/psr7": "^2.5", 744 | "httpsoft/http-message": "^1.1", 745 | "httpsoft/http-server-request": "^1.1", 746 | "laminas/laminas-diactoros": "^2.17", 747 | "nyholm/psr7": "^1.8", 748 | "nyholm/psr7-server": "^1.0", 749 | "phpspec/prophecy": "^1.17", 750 | "phpspec/prophecy-phpunit": "^2.0", 751 | "phpstan/phpstan": "^1.10", 752 | "phpunit/phpunit": "^9.6", 753 | "slim/http": "^1.3", 754 | "slim/psr7": "^1.6", 755 | "squizlabs/php_codesniffer": "^3.7" 756 | }, 757 | "suggest": { 758 | "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", 759 | "ext-xml": "Needed to support XML format in BodyParsingMiddleware", 760 | "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", 761 | "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." 762 | }, 763 | "type": "library", 764 | "autoload": { 765 | "psr-4": { 766 | "Slim\\": "Slim" 767 | } 768 | }, 769 | "notification-url": "https://packagist.org/downloads/", 770 | "license": [ 771 | "MIT" 772 | ], 773 | "authors": [ 774 | { 775 | "name": "Josh Lockhart", 776 | "email": "hello@joshlockhart.com", 777 | "homepage": "https://joshlockhart.com" 778 | }, 779 | { 780 | "name": "Andrew Smith", 781 | "email": "a.smith@silentworks.co.uk", 782 | "homepage": "http://silentworks.co.uk" 783 | }, 784 | { 785 | "name": "Rob Allen", 786 | "email": "rob@akrabat.com", 787 | "homepage": "http://akrabat.com" 788 | }, 789 | { 790 | "name": "Pierre Berube", 791 | "email": "pierre@lgse.com", 792 | "homepage": "http://www.lgse.com" 793 | }, 794 | { 795 | "name": "Gabriel Manricks", 796 | "email": "gmanricks@me.com", 797 | "homepage": "http://gabrielmanricks.com" 798 | } 799 | ], 800 | "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", 801 | "homepage": "https://www.slimframework.com", 802 | "keywords": [ 803 | "api", 804 | "framework", 805 | "micro", 806 | "router" 807 | ], 808 | "support": { 809 | "docs": "https://www.slimframework.com/docs/v4/", 810 | "forum": "https://discourse.slimframework.com/", 811 | "irc": "irc://irc.freenode.net:6667/slimphp", 812 | "issues": "https://github.com/slimphp/Slim/issues", 813 | "rss": "https://www.slimframework.com/blog/feed.rss", 814 | "slack": "https://slimphp.slack.com/", 815 | "source": "https://github.com/slimphp/Slim", 816 | "wiki": "https://github.com/slimphp/Slim/wiki" 817 | }, 818 | "funding": [ 819 | { 820 | "url": "https://opencollective.com/slimphp", 821 | "type": "open_collective" 822 | }, 823 | { 824 | "url": "https://tidelift.com/funding/github/packagist/slim/slim", 825 | "type": "tidelift" 826 | } 827 | ], 828 | "time": "2023-07-23T04:54:29+00:00" 829 | } 830 | ], 831 | "packages-dev": [], 832 | "aliases": [], 833 | "minimum-stability": "stable", 834 | "stability-flags": [], 835 | "prefer-stable": false, 836 | "prefer-lowest": false, 837 | "platform": [], 838 | "platform-dev": [], 839 | "plugin-api-version": "2.3.0" 840 | } 841 | -------------------------------------------------------------------------------- /config/bootstrap.php: -------------------------------------------------------------------------------- 1 | addDefinitions(__DIR__ . '/container.php') 11 | ->build(); 12 | 13 | // Create App instance 14 | return $container->get(App::class); 15 | -------------------------------------------------------------------------------- /config/container.php: -------------------------------------------------------------------------------- 1 | function () { 9 | return require __DIR__ . '/settings.php'; 10 | }, 11 | 12 | App::class => function (ContainerInterface $container) { 13 | $app = AppFactory::createFromContainer($container); 14 | 15 | // Register routes 16 | (require __DIR__ . '/routes.php')($app); 17 | 18 | // Register middleware 19 | (require __DIR__ . '/middleware.php')($app); 20 | 21 | return $app; 22 | }, 23 | ]; -------------------------------------------------------------------------------- /config/middleware.php: -------------------------------------------------------------------------------- 1 | addBodyParsingMiddleware(); 8 | 9 | // Add the Slim built-in routing middleware 10 | $app->addRoutingMiddleware(); 11 | 12 | // Handle exceptions 13 | $app->addErrorMiddleware(true, true, true); 14 | }; 15 | -------------------------------------------------------------------------------- /config/routes.php: -------------------------------------------------------------------------------- 1 | get('/', \App\Action\HomeAction::class); 7 | }; 8 | -------------------------------------------------------------------------------- /config/settings.php: -------------------------------------------------------------------------------- 1 | run(); -------------------------------------------------------------------------------- /src/Action/HomeAction.php: -------------------------------------------------------------------------------- 1 | getBody()->write('Hello, World!'); 13 | 14 | return $response; 15 | } 16 | } --------------------------------------------------------------------------------