- 浏览: 2552431 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
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 316I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 476NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 369Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 370Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 337Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 431Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 436Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 374Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 455VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 385Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 478NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 424Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 337Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 248GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 452GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 328GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 314Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 319Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 294Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 312Serverless with NodeJS and Tenc ...
相关推荐
本项目"Restful-Service-And-Restful-Client-master.zip"提供了RESTful风格的服务端和客户端的框架,旨在帮助开发者快速构建自己的RESTful API。 服务端部分: 1. **C#框架**:项目可能使用了C#语言进行开发,C#是...
instrumented-restful-fast-request-pro-2023.1.7.1 可用版,亲测,可用。
在`pyramid-restful-framework-0.6.5`这个压缩包中,可能包含了框架的源代码、示例项目、文档和测试用例。开发者可以通过阅读源码和文档来深入了解其工作原理和最佳实践。 总之,Pyramid RESTful Framework 0.6.5是...
Lumen 提供了与 Laravel 类似的语法和结构,但更加轻量级,性能更优,适合快速开发小型 RESTful 应用程序或作为大型系统的微服务。 ### 1. Lumen 的特点 - **轻量级**: Lumen 的核心库比 Laravel 更小,它只包含...
这个名为"restful-crud-实验.tar.gz"的压缩包文件显然是一个教学资源,旨在帮助学习者理解如何在SpringBoot应用中实现基于REST的创建(Create)、读取(Read)、更新(Update)和删除(Delete)功能。 首先,我们要...
- Lumen支持RESTful路由,可以通过`$app->get()`、`$app->post()`等方法定义路由。 - 路由可以接受参数,并且可以使用命名路由和路由组。 4. **控制器** - Lumen使用类似于Laravel的控制器结构,通过`php ...
《Spring Framework 5.1.4源码深度解析》 Spring Framework是Java开发中的核心框架,它为构建高质量的企业级应用提供了全面的支持。5.1.4版本是Spring的重要里程碑,引入了诸多新特性和改进,旨在提升性能、增强可...
Spring Framework 5.0.2.RELEASE 是一个重要的版本,它是Java开发中广泛使用的轻量级框架,尤其在企业级应用开发中占据了核心地位。这个官方完整包包含了Spring框架的所有组件,以及对应的官方文档,为开发者提供了...
例如,`perseus-restful-api-framework-1.17.32`目录下,可能包含如下内容: - `app.py`: 主应用文件,定义了路由和全局配置。 - `models/`: 存放数据模型,对应数据库表结构。 - `controllers/`: 控制器层,处理...
Lumen 是 Laravel 公司推出的一个轻量级的 RESTful API 开发框架,它拥有与 Laravel 类似的架构和组件,但体积更小、性能更高。Lumen 支持路由、中间件、控制器、Eloquent ORM 和其他 Laravel 功能,适合快速开发...
pip install perseus-restful-api-framework==1.24.3 ``` 使用Perseus创建一个基本的API服务,首先需要导入必要的模块,然后定义模型和路由,最后启动服务: ```python from perseus import App, Model, ...
《Spring Framework 4.2.0.RELEASE:官方完整包与文档详解》 Spring Framework作为Java开发中的核心框架,以其强大的依赖注入(Dependency Injection,DI)和面向切面编程(Aspect-Oriented Programming,AOP)功能...
Swagger是一个流行的API文档工具,它能帮助开发者通过OpenAPI规范来定义、设计、构建、发现和维护RESTful API。 "Laravel开发-lumen-swagger-generators"是一个专门为Lumen设计的扩展包,它的主要目标是简化Swagger...
在“spring-framework-3.2.0.RELEASE-dependencies”压缩包中,包含了Spring框架运行所需的各种依赖库,这些依赖对于理解和使用Spring框架至关重要。 1. **AOP(面向切面编程)支持**:Spring 提供了强大的 AOP ...
Spring Framework 是一个开源的应用程序框架,主要针对Java平台,它为构建企业级应用程序提供了全面的基础设施。Spring的核心特性包括依赖注入、面向切面编程(AOP)、模型-视图-控制器(MVC)架构模式以及对Java EE...
如果你需要构建 RESTful API 或微服务,Lumen 是一个理想的选择。 **VVV 配置 Lumen** 在 VVV 中安装和配置 Lumen 很简单。首先,你需要在你的项目目录下创建一个新的 Lumen 项目,通过 Composer 运行 `composer ...
Swagger-UI 是一个流行的工具,用于展示和测试基于 OpenAPI 规范的 RESTful API,而 Lumen 是 Laravel 的轻量级版本,特别适合构建高性能的微服务。 **一、Laravel 和 Lumen 概述** Laravel 是一款广泛使用的 PHP ...
它支持RESTful风格的路由,模板引擎,以及与各种视图技术的集成。 5. **数据访问**: Spring Data Access模块包括JDBC抽象层、ORM(Object-Relational Mapping)支持,如Hibernate和MyBatis,以及对JPA(Java ...
在"rest-api-lumen-源码.rar"这个压缩包中,包含的应该是使用Lumen框架构建的一个RESTful API的源代码。 首先,我们来看看Lumen框架的基础知识。Lumen继承了Laravel的许多优秀特性,如路由、中间件、服务提供者和...
而Lumen则是Laravel的一个轻量级版本,专为API和微服务架构设计,它提供了快速、简洁的方式来创建高质量的RESTful服务。这个名为"Laravel开发-pdf-lumen-bundle"的项目,显然关注的是如何在Lumen应用中生成PDF文件。...