Browse Source

Merge branch 'master' of github.com:mevdschee/php-crud-api

Maurits van der Schee 8 years ago
parent
commit
f965c61526
2 changed files with 16 additions and 39 deletions
  1. 16
    16
      README.md
  2. 0
    23
      examples/auth.php

+ 16
- 16
README.md View File

@@ -7,7 +7,7 @@ Single file PHP script that adds a REST API to a MySQL InnoDB database. PostgreS
7 7
 
8 8
 Related projects:
9 9
 
10
-  - [PHP-API-AUTH](https://github.com/mevdschee/php-api-auth): Authentication add-on supporting JWT + username/password.
10
+  - [PHP-API-AUTH](https://github.com/mevdschee/php-api-auth): Authentication add-on supporting JWT or username/password.
11 11
   - [PHP-SP-API](https://github.com/mevdschee/php-sp-api): Single file PHP script that adds a REST API to a SQL database.
12 12
   - [PHP-CRUD-UI](https://github.com/mevdschee/php-crud-ui): Single file PHP script that adds a UI to a PHP-CRUD-API project.
13 13
 
@@ -639,13 +639,13 @@ There are PHPUnit tests in the file 'tests.php'. You need to configure your test
639 639
 ```
640 640
 $ wget https://phar.phpunit.de/phpunit.phar
641 641
 $ php phpunit.phar tests/tests.php
642
-PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
642
+PHPUnit 5.3.2 by Sebastian Bergmann and contributors.
643 643
 
644
-.....................................                             37 / 37 (100%)
644
+..................................................                50 / 50 (100%)
645 645
 
646
-Time: 433 ms, Memory: 11.00Mb
646
+Time: 495 ms, Memory: 10.00Mb
647 647
 
648
-OK (37 tests, 61 assertions)
648
+OK (50 tests, 75 assertions)
649 649
 $
650 650
 ```
651 651
 
@@ -657,11 +657,11 @@ NB: You MUST use an empty database as a desctructive database fixture ('blog_mys
657 657
 C:\php-crud-api>"C:\PHP\php.exe" phpunit.phar tests\tests.php
658 658
 PHPUnit 5.2.10 by Sebastian Bergmann and contributors.
659 659
 
660
-.....................................                            37 / 37 (100%)
660
+..................................................                50 / 50 (100%)
661 661
 
662
-Time: 1.07 seconds, Memory: 6.50Mb
662
+Time: 1.47 seconds, Memory: 6.75Mb
663 663
 
664
-OK (37 tests, 59 assertions)
664
+OK (50 tests, 73 assertions)
665 665
 
666 666
 C:\php-crud-api>
667 667
 ```
@@ -673,13 +673,13 @@ NB: You MUST use an empty database as a desctructive database fixture ('blog_sql
673 673
 ```
674 674
 $ wget https://phar.phpunit.de/phpunit.phar
675 675
 $ php phpunit.phar tests/tests.php
676
-PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
676
+PHPUnit 5.3.2 by Sebastian Bergmann and contributors.
677 677
 
678
-.....................................                             37 / 37 (100%)
678
+..................................................                50 / 50 (100%)
679 679
 
680
-Time: 856 ms, Memory: 11.25Mb
680
+Time: 1.09 seconds, Memory: 8.00Mb
681 681
 
682
-OK (37 tests, 61 assertions)
682
+OK (50 tests, 75 assertions)
683 683
 $
684 684
 ```
685 685
 
@@ -690,13 +690,13 @@ NB: You MUST use an empty database as a desctructive database fixture ('blog_pos
690 690
 ```
691 691
 $ wget https://phar.phpunit.de/phpunit.phar
692 692
 $ php phpunit.phar tests/tests.php
693
-PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
693
+PHPUnit 5.3.2 by Sebastian Bergmann and contributors.
694 694
 
695
-.............................................                     45 / 45 (100%)
695
+..................................................                50 / 50 (100%)
696 696
 
697
-Time: 1.84 seconds, Memory: 11.25Mb
697
+Time: 1.96 seconds, Memory: 8.00Mb
698 698
 
699
-OK (45 tests, 69 assertions)
699
+OK (50 tests, 74 assertions)
700 700
 $
701 701
 ```
702 702
 

+ 0
- 23
examples/auth.php View File

@@ -1,23 +0,0 @@
1
-<?php
2
-if (!isset($_SERVER['PHP_AUTH_USER'])) {
3
-    header('WWW-Authenticate: Basic realm="My Realm"');
4
-    header('HTTP/1.0 401 Unauthorized');
5
-    echo 'Text to send if user hits Cancel button';
6
-    exit;
7
-} elseif ($_SERVER['PHP_AUTH_USER']!='user' || $_SERVER['PHP_AUTH_PW']!='pass') {
8
-    header('HTTP/1.0 403 Forbidden');
9
-    echo 'Forbidden';
10
-    exit;
11
-}
12
-
13
-include "api.php";
14
-
15
-$api = new PHP_CRUD_API(array(
16
-		'dbengine'=>'SQLServer',
17
-		'hostname'=>'(local)',
18
-		'username'=>'',
19
-		'password'=>'',
20
-		'database'=>'xxx',
21
-		'charset'=>'UTF-8'
22
-));
23
-$api->executeCommand();

Loading…
Cancel
Save