With composer Oauth2-server-php v0.9 (bshaffer)

Source: Internet
Author: User
Tags autoload autoloader dsn parse error composer install elgg

Download composer from official website

https://getcomposer.org/

Composer is a cross-platform and only describes Windows using composer

After the download is ready, install it.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/6E/wKioL1XQRv2gdvCZAAEJmNCozAk201.jpg "title=" 3154dab083174a729458abf2d9c976a1.jpg "alt=" Wkiol1xqrv2gdvczaaejmncozak201.jpg "/>

You can choose "Install Shell Menus", which will add composer's shortcut entry in the right-click menu.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/72/wKiom1XQRRTjGVvVAADoZzoBy04890.jpg "title=" 5882c7cb6f1448dca977333411f40934.jpg "alt=" Wkiom1xqrrtjgvvvaadozzoby04890.jpg "/>

Composer will automatically find the location of the Php.exe. You can also customize the location of PHP.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/71/6F/wKioL1XQRzKzYy9nAAEP9l-uLlg453.jpg "title=" 3f106de24dcd47f99da3ec694e022d02.jpg "alt=" Wkiol1xqrzkzyy9naaep9l-ullg453.jpg "/>


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/71/72/wKiom1XQRVfA1XqvAACWDYvSzKQ842.jpg "title=" Ee44cdf94622436a811bdc4bdb27fcf7.jpg "alt=" Wkiom1xqrvfa1xqvaacwdyvszkq842.jpg "/>

Download Composer.phar

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/6F/wKioL1XQR3_TyyPnAAEe3zqIMJE481.jpg "title=" B4e6e66ff47044218e026ef591ca35c8.jpg "alt=" Wkiol1xqr3_tyypnaaee3zqimje481.jpg "/>

Damn "Wall", connect on VPN.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/72/wKiom1XQRZDSAULeAAFKzIYR4-c585.jpg "title=" 548be4b07bf2436eb181ded73b36a88a.jpg "alt=" Wkiom1xqrzdsauleaafkziyr4-c585.jpg "/>

My php 5.3.3 is really old enough. Click Next.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/71/6F/wKioL1XQR7Ghmo_8AAE298pkOCY027.jpg "title=" 5e5304db2fe44012adb820078423343f.jpg "alt=" Wkiol1xqr7ghmo_8aae298pkocy027.jpg "/>

Successful, composer set the PATH environment variable. So you can use the composer command anywhere in command line.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/71/6F/wKioL1XQR9DQgmvuAAFJSKfk_8U480.jpg "title=" 9abc4a6d780b4c9294f46552eb308086.jpg "alt=" Wkiol1xqr9dqgmvuaafjskfk_8u480.jpg "/>

Here's a little bit of composer.

Create a new folder, C:\clearvale\elgg\ztest\oauth_server_bshaffer

As the Shell menu is installed,

So right-click on the folder to select Use Composer here

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/71/72/wKiom1XQReWipylpAAB2mZmBYU8360.jpg "title=" 6d68b9737fdf4da6976cf26022019f00.jpg "alt=" Wkiom1xqrewipylpaab2mzmbyu8360.jpg "/>


Now follow the most traditional way of using composer, creating a new Oauth_server_bshaffer/composer.json file.

This is demonstrated with Bshaffer's Oauth2 server. In composer.php, write the following content.

{

"Require": {

"bshaffer/oauth2-server-php": "~0.9"

}

}


<<<<<<<<<<<<<<<<<<<<

Here's a note, previously written

{

"Require": {

"bshaffer/oauth2-server-php": "~1.7",

}

}


First, one more, number.

Cause composer error.


C:\clearvale\elgg\ztest\oauth_server_bshaffer>composer Install

[Seld\jsonlint\parsingexception]

"./composer.json" does not contain valid JSON

Parse Error on line 3:

}

---------------------^

Expected: ' STRING '-It appears you has an extra trailing comma

Install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [-- No-autoloader] [--no-scripts] [--n

O-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [PACKAGESN]



After removing the comma, the following error is reported:

C:\clearvale\elgg\ztest\oauth_server_bshaffer>composer Install

Loading Composer repositories with the package information

Installing dependencies (including Require-dev)

Your requirements could not being resolved to an installable set of packages.

Problem 1

-Installation request for bshaffer/oauth2-server-php Dev-develop, satisfiable by bshaffer/oauth2-server-php[ Dev-develop].

-bshaffer/oauth2-server-php dev-develop requires PHP >=5.3.9-your PHP version (5.3.3) or "CONFIG.P latform.php "value does not satisfy that req

Uirement.

C:\clearvale\elgg\ztest\oauth_server_bshaffer>composer Install

Loading Composer repositories with the package information

Installing dependencies (including Require-dev)

Your requirements could not being resolved to an installable set of packages.

Problem 1

-bshaffer/oauth2-server-php v1.7.1 requires PHP >=5.3.9-your PHP version (5.3.3) or "config.platform.php" value does not satisfy that requirem

Ent.

-bshaffer/oauth2-server-php v1.7.0 requires PHP >=5.3.9-your PHP version (5.3.3) or "config.platform.php" value does not satisfy that requirem

Ent.

-Installation request for bshaffer/oauth2-server-php ~1.7 and satisfiable by bshaffer/oauth2-server-php[v1.7.0, v1.7.1].


To the effect that: 1.7 This version of the minimum PHP environment is PHP >= 5.3.9

So how many versions are there, and which version supports php5.3.3?

Access to composer's Packagelist official website.

https://packagist.org/packages/bshaffer/oauth2-server-php#v0.9

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/6F/wKioL1XQSBKzAa3RAANywUZeNU8092.jpg "title=" 338bc312ac184f64864ef909b5c0636c.jpg "alt=" Wkiol1xqsbkzaa3raanywuzenu8092.jpg "/>


Exactly, Bshaffer also recommended v0.9 for stable release.

>>>>>>>>>>>>>>>>>>>>>>>>>



So just install v0.9 and continue composer install.

C:\clearvale\elgg\ztest\oauth_server_bshaffer>composer Install

Loading Composer repositories with the package information

Installing dependencies (including Require-dev)

-Installing bshaffer/oauth2-server-php (v0.9)

downloading:100%


Writing Lock File

Generating autoload files


It worked. Composer has successfully installed the oauth2-server-php (v0.9),

View the files directory after installation.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/72/wKiom1XQRjHhcL-OAAD1XIDWFSc286.jpg "title=" Cc569108492d4be3aa4aca98fd06d02e.jpg "alt=" Wkiom1xqrjhhcl-oaad1xidwfsc286.jpg "/>

Composer.lock is used to lock the version of all packages. The presence of the Composer.lock file is checked during installation.

Composer.lock and Composer.json Control the version of the project together.

For example, now that the package has been loaded and run composer install again, nothing will be displayed to install or update.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/72/wKiom1XQRkmTJ3FzAACuUSphgEc312.jpg "title=" Ce7f1bc28c594c9db3d3afdd274480ca.jpg "alt=" Wkiom1xqrkmtj3fzaacuusphgec312.jpg "/>

oauth_server_php v0.9 Package has been installed.

Let's Test auto_load.

NEW: C:\clearvale\elgg\ztest\oauth_server_bshaffer\test.php

Write the following content:

<?phprequire ' vendor/autoload.php ';//token controller$dsn = "Mysql:my_oauth2_db;host=localhost"; $username = "root "; $password =" root "; $storage = new Oauth2_storage_pdo (Array (' dsn ' = = $dsn, ' username ' = = $username, ' password ' => ; $password));p Rint_r ($storage);

The $storage object is printed at the end.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/71/72/wkiom1xqrmlw4jnjaagnosiamdk140.jpg "title=" 82f90f8402a243179292e85ee9328b79.jpg "alt=" Wkiom1xqrmlw4jnjaagnosiamdk140.jpg "/>

Then the files inside the package are loaded automatically. Only need to require ' vendor/autoload.php ';

All the files in the package are ready to use.

End ...


(For more content on composer, visit: http://www.phpcomposer.com/)



This article is from the "technology from Now" blog, please be sure to keep this source http://rflyqhao.blog.51cto.com/5565993/1685014

With composer Oauth2-server-php v0.9 (bshaffer)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.