Sourcetreeを使いたい

source treeを使うには、まずatlassianのサイトからdownloadします
https://www.atlassian.com/ja/software/sourcetree

– SourceTreeのセットアップ
– SourceTreeを使う

$ cd project
$ ls
index.php
$ git init
$ git add .
$ git commit -m “first commit”
$ git remote add origin https://github.com/hpscript/sourcetree.git
$ git push -u origin master

なるほど、git tree上でgit操作をGUI交えて操作できるのね。大体理解した。

Xdebugとは

XdebugはPHPのエクステンションでデバッグ機能を提供
– スタックの追跡
– var_dumpを整形
– コードのボトルネックを提供

なるほど、vscodeでのxdebugも概要はなんとなく理解した

OpenAPI generatorとは?

OpenAPIはREST APIの定義を記述する規格
APIサーバがどのような挙動をするかを記した設計書
従来はSwagger Specificationと呼ばれた

### メリット
・決まったフォーマットで規定できる
・そのままAPIドキュメントになる
・API定義からサーバ・クライアントのコード生成ができる

サンプル
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml

### OpenAPI Generator
何らかの構造を定義して、定められた形式で定義
どのエンドポイントがどんなリクエストを受け付けてどんなレスポンスを返すのか

### OpenAPI
info, servers, paths, tags/externalDocs, components

Swagger Toolなどで生成する

### OpenAPI Generatorのはじめ方
openapi-generator generate -i ./openapi.yml -g php -o./php-api-client

### OpenAPIを使ってみる
openapi.yaml

openapi: "3.0.3"

info:
  title: "Sample API"
  version: "1.0.0"

paths:
  "/message":
    get:
      summary: "Sample API get operation"
      descrption: "Sample API get operation"
      responses:
        "200":
          description: "Success operation"
          content:
            application/json:
              schema:
                type: string
                example: "Hello World !"

$ sudo docker run –rm -v “${PWD}:/home/vagrant/dev/test” openapitools/openapi-generator-cli generate \
-i /home/vagrant/dev/test/openapi.yaml \
-g php-laravel \
-o /home/vagrant/dev/test/php-laravel

-attribute paths.’/message'(get).descrption is unexpected

ん? どういうことだ?
yamlファイルを作成してから、openapiでコードを生成する?
いまいち流れがわからん?

OpenAPI Generator から コードを作成することができるのね。

PHPの正規表現 ○を含む AND △を含む

$str = "0aZ";
if(preg_match("/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=\S+$).*$/", $str)){
	echo "マッチします。";
} else {
	echo "マッチしません。";
}

\S+$は半角を含まないという意味かな
なるほど、理解に時間がかかったわ

PHPの正規表現

test.php

$str = "123-4567";
if(preg_match("/^[0-9]{3}-[0-9]{4}$/", $str)){
	echo "マッチします。";
} else {
	echo "マッチしません。";
}

正規表現 半角文字

/^[\x21-\x7e]*$/

うーん 難しいな