Skip to content

Commit

Permalink
Merge pull request #223 from seamapi/issue-214-add-php-snippet
Browse files Browse the repository at this point in the history
#214 Add php snippet
  • Loading branch information
phpnode authored Nov 28, 2023
2 parents 74fefcd + eeacf20 commit 6a723ad
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
15 changes: 10 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ RUN apt-get install -y ruby ruby-dev
# Install Java
RUN apt-get install -y default-jdk

# Install PHP
RUN apt-get install -y php-cli php-xml php-mbstring
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

# Copy Go from the golang stage.
COPY --from=golang /usr/local/go /usr/local/go
ENV PATH="/usr/local/go/bin:${PATH}"
Expand All @@ -32,11 +36,12 @@ WORKDIR /home/node

# Install dotnet
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --channel 7.0
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --channel 7.0
ENV PATH="$PATH:/home/node/.dotnet"

RUN mkdir -p .config/git \
&& echo ".vscode/*" >> .config/git/ignore \
&& echo "*.code-workspace" >> .config/git/ignore \
&& echo ".history/" >> .config/git/ignore
&& echo ".vscode/*" >> .config/git/ignore \
&& echo "*.code-workspace" >> .config/git/ignore \
&& echo ".history/" >> .config/git/ignore

2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
]
}
},
"postCreateCommand": "cd /workspaces/api-docs/snippet-playground/javascript && npm i seamapi && cd /workspaces/api-docs/snippet-playground/csharp && ./init.sh",
"postCreateCommand": "cd /workspaces/api-docs/snippet-playground/javascript && npm i seamapi && cd /workspaces/api-docs/snippet-playground/csharp && ./init.sh && cd /workspaces/api-docs/snippet-playground/php && composer update",
"remoteUser": "node"
}
5 changes: 5 additions & 0 deletions snippet-playground/php/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!.gitignore
!README.md
!main.php
!composer.json
3 changes: 3 additions & 0 deletions snippet-playground/php/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Running PHP

Just run `php main.php`
5 changes: 5 additions & 0 deletions snippet-playground/php/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"seamapi/seam": "dev-main"
}
}
11 changes: 11 additions & 0 deletions snippet-playground/php/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
require __DIR__ . '/vendor/autoload.php';

$seam = new Seam\SeamClient(
"seam_apikey1_token",
"https://r" . md5(random_bytes(8)) . ".fakeseamconnect.seam.vc"
);

$devices = $seam->devices->list();

print_r($devices);

0 comments on commit 6a723ad

Please sign in to comment.