
PHP + LARAVEL + Passport 둘 이상의 Guard를 설정하는 것은 라라벨 공식 문서를 통해서 쉽게 확인이 가능하다. 세션과 Passport를 이용한 토큰 인증을 적용하여 router 마다 middleware에 적용하면 쉽게 사용할 수 있다. 기존에 무의식적으로 사용했던 client_credentials은 사용자에 대한 인증이라기 보다 머신(서버)에 대한 인증이라고 보는게 맞다. grant_type:Authorization_code를 이용하여 사용하려 했으나, 인증에 대한 middleware 를 동시에 사용하고자 하지만 기본적으로 하나의 인증이 실패할 경우 다음을 진행하지 않는다. 예를 들어 //route.php Route::get('user', function() {})->middlewa..

##composer 설치 curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin/ //curl이 없을 경우 php cli로 실행 php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/local/bin/ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2..

L5-Swagger BookController Get all books URL: /api/books Method: GET Description: Get all books /** * @OA\Get( * path="/api/books", * tags={"Books"}, * summary="Get all books", * @OA\Response( * response=200, * description="Returns all books", * @OA\JsonContent( * type="array", * @OA\Items(ref="#/components/schemas/Book") * ), * ), * ) */ public function index() { return Book::all(); } Create a n..

# Composer 설치 # composer 설치해준다. php5.6 이상에서 사용할 수 있음. composer require webonyx/graphql-php # Core/Controller.php class Graphql_Controller extends CI_Controller { public function __construct() { parent::__construct(); } public function response($schema=null) { try{ $input = json_decode(file_get_contents('php://input'), true); $query = $input['query']; $variableValues = isset($input['variables']) ..

PHP: array_count_values - Manual PHP: array_count_values - Manual In order to apply array_map with callback checking for localised values like city name, country name, you have to provide some sort of comparison array.Here's an example of array_count_values for Polish city names. Just switch array_keys / array_values in www.php.net /* * 배열에서 유니크한 키값과 갯수 조회하기 */ $array = array(1, "hello", 1, "wor..

PHP 에서 redis 에 연동하기 위한 client library predis: Pure PHP 로 개발 PHPRedis: C 언어로 만든 PHP 모듈 // 성능이 더 우수하다는 벤치마크 결과가 많다. ... 1. 설치하기 //yum으로 설치 yum install php-devel //apt로 설치 sudo apt install php-dev Linux 공통 // pecl install redis // igbinary 지원 여부: yes enable igbinary serializer support? [no] : yes // lzf 압축 지원 여부: yes enable lzf compression support? [no] : yes RHEL/Centos // php 의 모듈 디렉터리에 로딩을 위한 모듈..