백엔드 개발 PHP 튜토리얼 PHP(七)RESTful Framework - Lumen - Settings and Env

PHP(七)RESTful Framework - Lumen - Settings and Env

Jun 13, 2016 pm 12:24 PM
create gt mysql php with

PHP(7)RESTful Framework - Lumen - Settings and Env
PHP(7)RESTful Framework - Lumen - Settings and Env

1. Install lumen
Install composer
http://coderexample.com/composer-easy-tutorial/

composer will downloading dependency library automatically, and it will create a single autoloader.php and autoload all the dependency into our project.

> curl -sS https://getcomposer.org/installer | php

This method will download the composer executive file. Actually I use that before, but we can move a little further, we can directly copy the executive file to our PATH directory.
> sudo mv composer.phar /usr/bin/composer

Verify installation
> composer --version
Composer version 1.0-dev (f1aa655e6113e0efa979b8b09d7951a762eaa04c) 2015-08-20 11:59:54

2. Create the Sample Project
There is a lot of great source from here https://packagist.org/

This command will create a sample REST PHP project for us.
> composer create-project laravel/lumen easyphprest

Go into that directory. This command will tell us a lot of useful commands.
> php artisan
Laravel Framework version Lumen (5.1.3) (Laravel Components 5.1.*)

Command to start the HTTP Service
> php artisan serve
Lumen development server started on http://localhost:8000/

Install and Configure MYSQL
After directly install dmz file on MAC, I start mysql as follow:
> sudo /usr/local/mysql/support-files/mysql.server start

Database configuration is in this place
>cat .env
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=easyphprest
DB_USERNAME=easyphprest
DB_PASSWORD=easyphprest

Uncomments the configuration
>cat bootstrap/app.php
Dotenv::load(__DIR__.'/../');
$app->withFacades();
$app->withEloquent();

Create the Migration Database
> php artisan make:migration create_books_table
Created Migration: 2015_08_28_183001_create_books_table

This will create a file under database/migrations/

Something like flywayDB.
Run the command to start the migration table operation
> php artisan migrate

Error Message:

  [PDOException]
  could not find driver


Solution:
uncomment out the line in php.ini
extension=php_pdo_mysql.dll

The link of the source
http://ar2.php.net/distributions/php-5.6.10.tar.gz

http://ar2.php.net/distributions/php-5.6.11.tar.gz

Install pear   http://pear.php.net/manual/en/installation.getting.php

> wget http://pear.php.net/go-pear.phar

> php go-pear.phar

Try to install pdo_mysql
> pear install pdo_mysql

> pecl install pdo_mysql

Exception:
configure: error: Cannot find MySQL header files under
ERROR: `/private/tmp/pear/install/PDO_MYSQL/configure' failed

Solution:
Manually install that
http://stackoverflow.com/questions/384809/pdo-mysql-driver-on-mac

> pecl download pdo_mysql

> tar zxvf PDO_MYSQL-1.0.2.tgz

> phpize

> ./configure --with-pdo-mysql=/usr/local/mysql

> make

Fail Exception:
./php_pdo_mysql_int.h:25:10: fatal error: 'mysql.h' file not found
#include

easily copy all the mysql header files here
> cp /usr/local/mysql/include/*.h ./

> make

Maybe, I need to reinstall my PHP with this PDO MYSQL enable.
Reinstall PHP
http://sillycat.iteye.com/blog/2223621

Fetch the latest PHP
> wget http://ar2.php.net/distributions/php-5.6.11.tar.gz

Unzip and installation
> ./configure --prefix=/Users/carl/tool/php-5.6.11 --with-openssl --with-iconv-dir=/usr/lib --with-curl=/opt/local/include/curl --with-mysql --enable-fpm --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-mysqli --with-pdo-mysql --with-zlib

After installation, switch to this latest version of PHP. It works.
> php artisan migrate
Migration table created successfully.
Migrated: 2015_08_28_183001_create_books_table

The database table will show on the Squel Pro

References:
Slim Framework
http://www.slimframework.com/

laravel - Web Framework similar to symfony2
http://www.golaravel.com/
http://laravel-china.org/docs/4.2/introduction
http://www.golaravel.com/

lumen - RESTful framework mini version of laravel
http://lumen.laravel.com/
http://segmentfault.com/a/1190000002724037
http://lumen.laravel-china.org/
https://phphub.org/topics/701
http://lumen.laravel-china.org/docs

x-debug
https://wiki.eclipse.org/Debugging_using_XDebug

https://github.com/nordsoftware/lumen-rest
http://coderexample.com/restful-api-in-lumen-a-laravel-micro-framework/

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Ubuntu 및 Debian용 PHP 8.4 설치 및 업그레이드 가이드 Ubuntu 및 Debian용 PHP 8.4 설치 및 업그레이드 가이드 Dec 24, 2024 pm 04:42 PM

PHP 8.4는 상당한 양의 기능 중단 및 제거를 통해 몇 가지 새로운 기능, 보안 개선 및 성능 개선을 제공합니다. 이 가이드에서는 Ubuntu, Debian 또는 해당 파생 제품에서 PHP 8.4를 설치하거나 PHP 8.4로 업그레이드하는 방법을 설명합니다.

MySQL 8.4에서 mysql_native_password가 로드되지 않음 오류를 수정하는 방법 MySQL 8.4에서 mysql_native_password가 로드되지 않음 오류를 수정하는 방법 Dec 09, 2024 am 11:42 AM

MySQL 8.4(2024년 최신 LTS 릴리스)에 도입된 주요 변경 사항 중 하나는 "MySQL 기본 비밀번호" 플러그인이 더 이상 기본적으로 활성화되지 않는다는 것입니다. 또한 MySQL 9.0에서는 이 플러그인을 완전히 제거합니다. 이 변경 사항은 PHP 및 기타 앱에 영향을 미칩니다.

PHP 개발을 위해 Visual Studio Code(VS Code)를 설정하는 방법 PHP 개발을 위해 Visual Studio Code(VS Code)를 설정하는 방법 Dec 20, 2024 am 11:31 AM

VS Code라고도 알려진 Visual Studio Code는 모든 주요 운영 체제에서 사용할 수 있는 무료 소스 코드 편집기 또는 통합 개발 환경(IDE)입니다. 다양한 프로그래밍 언어에 대한 대규모 확장 모음을 통해 VS Code는

PHP에서 HTML/XML을 어떻게 구문 분석하고 처리합니까? PHP에서 HTML/XML을 어떻게 구문 분석하고 처리합니까? Feb 07, 2025 am 11:57 AM

이 튜토리얼은 PHP를 사용하여 XML 문서를 효율적으로 처리하는 방법을 보여줍니다. XML (Extensible Markup Language)은 인간의 가독성과 기계 구문 분석을 위해 설계된 다목적 텍스트 기반 마크 업 언어입니다. 일반적으로 데이터 저장 AN에 사용됩니다

문자열로 모음을 계산하는 PHP 프로그램 문자열로 모음을 계산하는 PHP 프로그램 Feb 07, 2025 pm 12:12 PM

문자열은 문자, 숫자 및 기호를 포함하여 일련의 문자입니다. 이 튜토리얼은 다른 방법을 사용하여 PHP의 주어진 문자열의 모음 수를 계산하는 방법을 배웁니다. 영어의 모음은 A, E, I, O, U이며 대문자 또는 소문자 일 수 있습니다. 모음이란 무엇입니까? 모음은 특정 발음을 나타내는 알파벳 문자입니다. 대문자와 소문자를 포함하여 영어에는 5 개의 모음이 있습니다. a, e, i, o, u 예 1 입력 : String = "Tutorialspoint" 출력 : 6 설명하다 문자열의 "Tutorialspoint"의 모음은 u, o, i, a, o, i입니다. 총 6 개의 위안이 있습니다

이전에 몰랐던 후회되는 PHP 함수 7가지 이전에 몰랐던 후회되는 PHP 함수 7가지 Nov 13, 2024 am 09:42 AM

숙련된 PHP 개발자라면 이미 그런 일을 해왔다는 느낌을 받을 것입니다. 귀하는 상당한 수의 애플리케이션을 개발하고, 수백만 줄의 코드를 디버깅하고, 여러 스크립트를 수정하여 작업을 수행했습니다.

2024년 개발자를 위한 상위 10대 PHP CMS 플랫폼 2024년 개발자를 위한 상위 10대 PHP CMS 플랫폼 Dec 05, 2024 am 10:29 AM

CMS는 콘텐츠 관리 시스템을 의미합니다. 사용자가 고급 기술 지식 없이도 디지털 콘텐츠를 생성, 관리 및 수정할 수 있는 소프트웨어 애플리케이션 또는 플랫폼입니다. CMS를 사용하면 사용자가 콘텐츠를 쉽게 생성하고 구성할 수 있습니다.

PHP에서 배열 끝에 요소를 추가하는 방법 PHP에서 배열 끝에 요소를 추가하는 방법 Feb 07, 2025 am 11:17 AM

배열은 프로그래밍에서 데이터를 처리하는 데 사용되는 선형 데이터 구조입니다. 때로는 배열을 처리 할 때 기존 배열에 새 요소를 추가해야합니다. 이 기사에서는 각 방법에 대한 코드 예제, 출력 및 시간 및 공간 복잡성 분석을 통해 PHP의 배열 끝에 요소를 추가하는 몇 가지 방법에 대해 논의합니다. 배열에 요소를 추가하는 다양한 방법은 다음과 같습니다. 사각형 브래킷 사용 [] PHP에서 배열 끝에 요소를 추가하는 방법은 사각형 브래킷을 사용하는 것입니다 []. 이 구문은 단일 요소 만 추가하려는 경우에만 작동합니다. 다음은 구문입니다. $ array [] = value; 예

See all articles