Skip to content

Commit e0f88bd

Browse files
committed
Update PHP Laravel quickstart tutorial with corrected bucket reference, added Docker environment variables, and enhanced Swagger UI instructions.
1 parent f55ab8d commit e0f88bd

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tutorial/markdown/php/quickstart-php-laravel/php-laravel.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ length: 30 Mins
3333

3434
To run this prebuilt project, you will need:
3535

36-
- [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with [travel-sample](https://docs.couchbase.com/dotnet-sdk/current/ref/travel-app-data-model.html) bucket loaded.
36+
- [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with [travel-sample](https://docs.couchbase.com/php-sdk/current/ref/travel-app-data-model.html) bucket loaded.
3737
- To run this tutorial using a self managed Couchbase cluster, please refer to the [appendix](#running-self-managed-couchbase-cluster).
3838
- PHP installed
3939
- Code Editor installed (Visual Studio Code, PhpStorm, or Sublime Text)
@@ -48,6 +48,7 @@ git clone https://github.com/couchbase-examples/php-laravel-quickstart.git
4848
### Install Dependencies
4949

5050
```shell
51+
cd php-laravel-quickstart
5152
composer install
5253
```
5354

@@ -100,6 +101,12 @@ php artisan serve
100101

101102
> Note: Either the Couchbase Server must be installed and running on localhost or the connection string must be updated in the `config/couchbase.php` file.
102103
104+
> Tip: If Swagger UI loads without endpoints, generate the docs:
105+
>
106+
> ```sh
107+
> php artisan l5-swagger:generate
108+
> ```
109+
103110
### Docker
104111
105112
Build the Docker image
@@ -111,20 +118,25 @@ docker build -t php-laravel-quickstart .
111118
Run the Docker image
112119

113120
```sh
114-
docker run -d --name laravel-container -p 8000:8000 php-laravel-quickstart -e DB_CONN_STR=<connection_string> -e DB_USERNAME=<username> -e DB_PASSWORD=<password>
121+
docker run -d --name laravel-container -p 8000:8000 \
122+
-e DB_CONN_STR=<connection_string> \
123+
-e DB_USERNAME=<username> \
124+
-e DB_PASSWORD=<password> \
125+
-e DB_BUCKET=travel-sample \
126+
php-laravel-quickstart
115127
```
116128

117129
Note: The `config/couchbase.php` file has the connection information to connect to your Capella cluster. You can also pass the connection information as environment variables to the Docker container.
118130
If you choose not to pass the environment variables, you can update the `config/couchbase.php` file in the root directory.
119131

120-
Once the application is running, you can access it in your browser at [http://localhost:8000](http://localhost:8000).
132+
Once the application is running, you can access it in your browser at [http://localhost:8000](http://localhost:8000). Swagger UI is available at [http://localhost:8000/api/documentation](http://localhost:8000/api/documentation).
121133

122134
### Verifying the Application
123135

124136
Once the application starts, you can see the details of the application on the logs.
125137
![Application Startup](./php-quickstart-app-startup.png)
126138

127-
The application will run on port 8000 of your local machine (http://localhost:8000). You will find the Swagger documentation of the API if you go to the URL in your browser. Swagger documentation is used in this demo to showcase the different API endpoints and how they can be invoked. More details on the Swagger documentation can be found in the [appendix](#swagger-documentation).
139+
The application will run on port 8000 of your local machine (http://localhost:8000). Open Swagger UI at [http://localhost:8000/api/documentation](http://localhost:8000/api/documentation) to try the API endpoints. Swagger documentation is used in this demo to showcase the different API endpoints and how they can be invoked. More details on the Swagger documentation can be found in the [appendix](#swagger-documentation).
128140

129141
![Swagger Documentation](./php-quickstart-swagger.png)
130142

@@ -400,14 +412,14 @@ If you are running this quickstart with a self-managed Couchbase cluster, you ne
400412
You need to update the connection string and the credentials in the `config/couchbase.php` file:
401413

402414
```env
403-
DB_CONN_STR_=couchbase://<your-couchbase-server>
415+
DB_CONN_STR=couchbase://<your-couchbase-server>
404416
DB_USERNAME=<your-username>
405417
DB_PASSWORD=<your-password>
406418
DB_BUCKET=travel-sample
407419
```
408420

409421
Replace `<your-couchbase-server>`, `<your-username>`, and `<your-password>` with your actual Couchbase server details and credentials.
410-
> **NOTE:** Couchbase must be installed and running prior to running the Spring Boot app.
422+
> **NOTE:** Couchbase must be installed and running prior to running the Laravel app.
411423
412424
### Swagger Documentation
413425

0 commit comments

Comments
 (0)