Skip to content

Commit 22fbddc

Browse files
committed
added cake example and inital readmes
0 parents  commit 22fbddc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+7013
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
composer.phar

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Vanilla PHP
2+
3+
I'd recommend shying away from plain vanilla PHP unless you for sure, for sure know what you are doing. (and even then, you probably shouldn't but if you insist...)
4+
5+
If I were forced to, I'd probably still use composer to pull in `symfony/http-foundation` and other components to help out like Doctrine for API Models/Repositories.
6+
7+
You can find an example of a [https://github.com/php-vegas/starter-app](simple php site) and use bits of it for an API app instead.
8+
9+
There are a few "Quick RESTful PHP API" tutorials out there but honestly, I'd advise from a security and maintenance standpoint you just pick any _major_ open-source framework that either your team or you are good in or end up enjoying. It will save you a ton of time later when other devs or the product owner throws big feature requests at you.

cakephp/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# CakePHP
2+
3+
## Install
4+
5+
`composer create-project --prefer-dist cakephp/app cakeapi`
6+
7+
## Details
8+
9+
47 Packages - 24~ MB of files in vendor/
10+
11+
Use of Symfony components and twig
12+
13+
The CakePHP ORM borrows ideas and concepts from both ActiveRecord and Datamapper patterns.
14+
15+
## Thoughts
16+
17+
It was relatively easy to setup this basic API. I would have to start converting this to use Tables/Entities.
18+
I ended up following the instructions here for Cake 3.6 Cookbook on REST - https://book.cakephp.org/3.0/en/development/rest.html
19+
20+
It took me about an hour or two of on and off playing with cake to get this basic REST api going.

cakephp/cakeapi/.editorconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.bat]
14+
end_of_line = crlf
15+
16+
[*.yml]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[*.twig]
21+
insert_final_newline = false
22+
23+
[Makefile]
24+
indent_style = tab

cakephp/cakeapi/.gitattributes

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Define the line ending behavior of the different file extensions
2+
# Set default behaviour, in case users don't have core.autocrlf set.
3+
* text=auto
4+
* text eol=lf
5+
6+
# Explicitly declare text files we want to always be normalized and converted
7+
# to native line endings on checkout.
8+
*.php text
9+
*.default text
10+
*.ctp text
11+
*.sql text
12+
*.md text
13+
*.po text
14+
*.js text
15+
*.css text
16+
*.ini text
17+
*.properties text
18+
*.txt text
19+
*.xml text
20+
*.svg text
21+
*.yml text
22+
.htaccess text
23+
24+
# Declare files that will always have CRLF line endings on checkout.
25+
*.bat eol=crlf
26+
27+
# Declare files that will always have LF line endings on checkout.
28+
*.pem eol=lf
29+
30+
# Denote all files that are truly binary and should not be modified.
31+
*.png binary
32+
*.jpg binary
33+
*.gif binary
34+
*.ico binary
35+
*.mo binary
36+
*.pdf binary
37+
*.phar binary
38+
*.woff binary
39+
*.woff2 binary
40+
*.ttf binary
41+
*.otf binary
42+
*.eot binary
43+
*.gz binary
44+
*.bz2 binary
45+
*.7z binary
46+
*.zip binary
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
This is a (multiple allowed):
2+
3+
* [x] bug
4+
* [ ] enhancement
5+
* [ ] feature-discussion (RFC)
6+
7+
* CakePHP Application Skeleton Version: EXACT RELEASE VERSION OR COMMIT HASH, HERE.
8+
* Platform and Target: YOUR WEB-SERVER, DATABASE AND OTHER RELEVANT INFO AND HOW THE REQUEST IS BEING MADE, HERE.
9+
10+
### What you did
11+
EXPLAIN WHAT YOU DID, PREFERABLY WITH CODE EXAMPLES, HERE.
12+
13+
### What happened
14+
EXPLAIN WHAT IS ACTUALLY HAPPENING, HERE.
15+
16+
### What you expected to happen
17+
EXPLAIN WHAT IS TO BE EXPECTED, HERE.
18+
19+
P.S. Remember, an issue is not the place to ask questions. You can use [Stack Overflow](https://stackoverflow.com/questions/tagged/cakephp)
20+
for that or join the #cakephp channel on irc.freenode.net, where we will be more
21+
than happy to help answer your questions.
22+
23+
Before you open an issue, please check if a similar issue already exists or has been closed before.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**PLEASE NOTE:**
2+
3+
This is only a issue tracker for issues related to the CakePHP Application Skeleton.
4+
For CakePHP Framework issues please use this [issue tracker](https://github.com/cakephp/cakephp/issues).
5+
6+
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
7+
8+
The best way to propose a feature is to open an issue first and discuss your ideas there before implementing them.
9+
10+
Always follow the [contribution guidelines](https://github.com/cakephp/cakephp/blob/master/.github/CONTRIBUTING.md) guidelines when submitting a pull request. In particular, make sure existing tests still pass, and add tests for all new behavior. When fixing a bug, you may want to add a test to verify the fix.

cakephp/cakeapi/.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# CakePHP specific files #
2+
##########################
3+
/config/app.php
4+
/config/.env
5+
/logs/*
6+
/tmp/*
7+
/vendor/*
8+
9+
# OS generated files #
10+
######################
11+
.DS_Store
12+
.DS_Store?
13+
._*
14+
.Spotlight-V100
15+
.Trashes
16+
Icon?
17+
ehthumbs.db
18+
Thumbs.db
19+
20+
# Tool specific files #
21+
#######################
22+
# vim
23+
*~
24+
*.swp
25+
*.swo
26+
# sublime text & textmate
27+
*.sublime-*
28+
*.stTheme.cache
29+
*.tmlanguage.cache
30+
*.tmPreferences.cache
31+
# Eclipse
32+
.settings/*
33+
# JetBrains, aka PHPStorm, IntelliJ IDEA
34+
.idea/*
35+
# NetBeans
36+
nbproject/*
37+
# Visual Studio Code
38+
.vscode
39+
# Sass preprocessor
40+
.sass-cache/

cakephp/cakeapi/.htaccess

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Uncomment the following to prevent the httpoxy vulnerability
2+
# See: https://httpoxy.org/
3+
#<IfModule mod_headers.c>
4+
# RequestHeader unset Proxy
5+
#</IfModule>
6+
7+
<IfModule mod_rewrite.c>
8+
RewriteEngine on
9+
RewriteRule ^(\.well-known/.*)$ $1 [L]
10+
RewriteRule ^$ webroot/ [L]
11+
RewriteRule (.*) webroot/$1 [L]
12+
</IfModule>

cakephp/cakeapi/.travis.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
language: php
2+
3+
dist: trusty
4+
5+
sudo: false
6+
7+
php:
8+
- 5.6
9+
- 7.0
10+
- 7.1
11+
- 7.2
12+
13+
matrix:
14+
fast_finish: true
15+
16+
include:
17+
- php: 7.0
18+
env: PHPCS=1
19+
20+
before_script:
21+
- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:~2.1; fi
22+
- if [[ $PHPCS != 1 ]]; then composer install; fi
23+
- if [[ $PHPCS != 1 ]]; then composer require phpunit/phpunit:"^5.7|^6.0"; fi
24+
- if [[ $PHPCS != 1 ]]; then composer run-script post-install-cmd --no-interaction; fi
25+
26+
script:
27+
- if [[ $PHPCS != 1 ]]; then vendor/bin/phpunit; fi
28+
- if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests ./config ./webroot; fi
29+
30+
notifications:
31+
email: false

cakephp/cakeapi/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# CakePHP Application Skeleton
2+
3+
[![Build Status](https://img.shields.io/travis/cakephp/app/master.svg?style=flat-square)](https://travis-ci.org/cakephp/app)
4+
[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/app.svg?style=flat-square)](https://packagist.org/packages/cakephp/app)
5+
6+
A skeleton for creating applications with [CakePHP](https://cakephp.org) 3.x.
7+
8+
The framework source code can be found here: [cakephp/cakephp](https://github.com/cakephp/cakephp).
9+
10+
## Installation
11+
12+
1. Download [Composer](https://getcomposer.org/doc/00-intro.md) or update `composer self-update`.
13+
2. Run `php composer.phar create-project --prefer-dist cakephp/app [app_name]`.
14+
15+
If Composer is installed globally, run
16+
17+
```bash
18+
composer create-project --prefer-dist cakephp/app
19+
```
20+
21+
In case you want to use a custom app dir name (e.g. `/myapp/`):
22+
23+
```bash
24+
composer create-project --prefer-dist cakephp/app myapp
25+
```
26+
27+
You can now either use your machine's webserver to view the default home page, or start
28+
up the built-in webserver with:
29+
30+
```bash
31+
bin/cake server -p 8765
32+
```
33+
34+
Then visit `http://localhost:8765` to see the welcome page.
35+
36+
## Update
37+
38+
Since this skeleton is a starting point for your application and various files
39+
would have been modified as per your needs, there isn't a way to provide
40+
automated upgrades, so you have to do any updates manually.
41+
42+
## Configuration
43+
44+
Read and edit `config/app.php` and setup the `'Datasources'` and any other
45+
configuration relevant for your application.
46+
47+
## Layout
48+
49+
The app skeleton uses a subset of [Foundation](http://foundation.zurb.com/) (v5) CSS
50+
framework by default. You can, however, replace it with any other library or
51+
custom styles.

cakephp/cakeapi/bin/cake

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env sh
2+
################################################################################
3+
#
4+
# Cake is a shell script for invoking CakePHP shell commands
5+
#
6+
# CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
7+
# Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
8+
#
9+
# Licensed under The MIT License
10+
# For full copyright and license information, please see the LICENSE.txt
11+
# Redistributions of files must retain the above copyright notice.
12+
#
13+
# @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
14+
# @link https://cakephp.org CakePHP(tm) Project
15+
# @since 1.2.0
16+
# @license https://opensource.org/licenses/mit-license.php MIT License
17+
#
18+
################################################################################
19+
20+
# Canonicalize by following every symlink of the given name recursively
21+
canonicalize() {
22+
NAME="$1"
23+
if [ -f "$NAME" ]
24+
then
25+
DIR=$(dirname -- "$NAME")
26+
NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
27+
fi
28+
while [ -h "$NAME" ]; do
29+
DIR=$(dirname -- "$NAME")
30+
SYM=$(readlink "$NAME")
31+
NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM")
32+
done
33+
echo "$NAME"
34+
}
35+
36+
# Find a CLI version of PHP
37+
findCliPhp() {
38+
for TESTEXEC in php php-cli /usr/local/bin/php
39+
do
40+
SAPI=`echo "<?= PHP_SAPI ?>" | $TESTEXEC 2>/dev/null`
41+
if [ "$SAPI" = "cli" ]
42+
then
43+
echo $TESTEXEC
44+
return
45+
fi
46+
done
47+
echo "Failed to find a CLI version of PHP; falling back to system standard php executable" >&2
48+
echo "php";
49+
}
50+
51+
CONSOLE=$(dirname -- "$(canonicalize "$0")")
52+
APP=$(dirname "$CONSOLE")
53+
54+
# If your CLI PHP is somewhere that this doesn't find, you can define a PHP environment
55+
# variable with the correct path in it.
56+
if [ -z "$PHP" ]
57+
then
58+
PHP=$(findCliPhp)
59+
fi
60+
61+
if [ $(basename $0) != 'cake' ]
62+
then
63+
exec $PHP "$CONSOLE"/cake.php $(basename $0) "$@"
64+
else
65+
exec $PHP "$CONSOLE"/cake.php "$@"
66+
fi
67+
68+
exit

cakephp/cakeapi/bin/cake.bat

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2+
::
3+
:: Cake is a Windows batch script for invoking CakePHP shell commands
4+
::
5+
:: CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
6+
:: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
7+
::
8+
:: Licensed under The MIT License
9+
:: Redistributions of files must retain the above copyright notice.
10+
::
11+
:: @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
12+
:: @link https://cakephp.org CakePHP(tm) Project
13+
:: @since 2.0.0
14+
:: @license https://opensource.org/licenses/mit-license.php MIT License
15+
::
16+
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
17+
18+
@echo off
19+
20+
SET app=%0
21+
SET lib=%~dp0
22+
23+
php "%lib%cake.php" %*
24+
25+
echo.
26+
27+
exit /B %ERRORLEVEL%

cakephp/cakeapi/bin/cake.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/php -q
2+
<?php
3+
// Check platform requirements
4+
require dirname(__DIR__) . '/config/requirements.php';
5+
require dirname(__DIR__) . '/vendor/autoload.php';
6+
7+
use App\Application;
8+
use Cake\Console\CommandRunner;
9+
10+
// Build the runner with an application and root executable name.
11+
$runner = new CommandRunner(new Application(dirname(__DIR__) . '/config'), 'cake');
12+
exit($runner->run($argv));

0 commit comments

Comments
 (0)