PHPackages                             weigreen/ncuportal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. weigreen/ncuportal

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

weigreen/ncuportal
==================

ncu portal library

1.0.0(11y ago)283MITPHPPHP &gt;=5.4.0

Since Apr 8Pushed 11y agoCompare

[ Source](https://github.com/andy199310/NCUPortal)[ Packagist](https://packagist.org/packages/weigreen/ncuportal)[ RSS](/packages/weigreen-ncuportal/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

NCU portal login
================

[](#ncu-portal-login)

NCUPortal is a library providing an easier and expressive way to use [NCU Portal](https://portal.ncu.edu.tw) to let users login to your application.

Requirements
------------

[](#requirements)

- PHP &gt;=5.4

Installation
------------

[](#installation)

Add this to your composer.json.

```
"require": {
  "weigreen/ncuportal": "v1.0.0"
}
```

Examples
--------

[](#examples)

First phase (create url to redirect user to ncu portal)

```
// Set up NCUPortal with your application's domain
$ncuPortal = new NCUPortal('your-application-domain');

// Get Auth URL with call back url
$ncuPortal->getAuthUrl('call-back-url');
```

PS: callback url is used when user login on [NCU Portal](https://portal.ncu.edu.tw) and will redirect to callback url

Second phase (callback)

```
// Set up NCUPortal with your application's domain
$ncuPortal = new NCUPortal('your-application-domain');

// Check if callback is validate or not
// One time used. Second call will be false
if($ncuPortal->checkLoginValidate()){
  echo "Login Real";
  // get login account
  echo $ncuPortal->getLoginAccount();
}else{
  echo "Login is not real >_
