- 浏览: 2489484 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
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 <mysql.h>
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/
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 <mysql.h>
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/
发表评论
-
Stop Update Here
2020-04-28 09:00 264I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 433NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 314Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 324Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 295Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 381Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 378Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 329Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 403VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 337Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 419NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 365Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 294Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 211GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 394GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 278GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 266Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 267Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 255Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 240Serverless with NodeJS and Tenc ...
相关推荐
python库。 资源全名:pyramid-restful-framework-0.6.5.tar.gz
instrumented-restful-fast-request-pro-2023.1.7.1 可用版,亲测,可用。
提供restful风格的框架, 拥有客户端和服务端两部分, 具体实现功能代码需要自己添加。
python库。 资源全名:perseus-restful-api-framework-1.24.3.tar.gz
资源来自pypi官网。 资源全名:perseus-restful-api-framework-1.17.32.tar.gz
Java SpringBoot 课程 restful crud 实验资源 restful 风格的增删改查
OPCserver转WebAPI借口案例程序
资源来自pypi官网。 资源全名:flask-restful-swagger-3-0.2.0.tar.gz
SAP-BO-Restful-SDK-开发指导手册
eggJS框架、nodeJS、rbac权限、restfulAPI-edward-egg-gateway
laravel-restful-api-starter, 使用 Laravel 和MongoDB构建一个 RESTful API #Laravel Restful API启动程序现在查看一下 WIKI !欢迎捐赠对于代码和 doc: ) !是什么?这里启动器基于以下功能:Laravel 4.2: 使用轻...
本资源类似于 Postman 的 IDEA 插件Restful Fast Request,在IDEA安装该插件后,找到插件安装目录,【C:\\... API Buddy\\lib】替换掉里面的jar文件【instrumented-restful-fast-request-pro-2023.1.7.1.jar】即可使用
5、HDFS API的RESTful风格--WebHDFS 网址:https://blog.csdn.net/chenwewi520feng/article/details/130335776 本文简单介绍WebHDFS和使用。
simple-restful-api-php-源码.rar
spring boot学习的web开发课程资源 spring boot学习的web开发课程资源 spring boot学习的web开发课程资源 spring boot学习的web开发课程资源 spring boot学习的web开发课程资源 spring boot学习的web开发课程...
JAX-RS即Java API for RESTful Web Services,是一个Java 编程语言的应用程序接口,支持按照表述性状态转移(REST)架构风格创建Web服务。JAX-RS使用了Java SE5引入的Java标注来简化Web服务的客户端和服务端的开发...
Building-RESTful-Python-Web-Services.pdf
Java-RESTful-Web-Service.rar
Java SpringBoot 课程 restful crud 实验资源 ...GitHub中有源码 https://github.com/kevinkda/MarkdownRepository/tree/master/Develop%20Demo/Java%20Framework/Spring/SpringBoot/spring-boot-restful-crud-01
RESTful-API-design-OCTO-Quick-Reference-Card-2.2