Repository: zfcampus/zf-apigility-skeleton
Branch: master
Commit: fd7fc27169e3
Files: 40
Total size: 49.7 KB
Directory structure:
gitextract_1rl9e0ja/
├── .dockerignore
├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE.md
├── README.md
├── SUPPORT.md
├── Vagrantfile
├── composer.json
├── config/
│ ├── application.config.php
│ ├── autoload/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── global-development.php
│ │ ├── global.php
│ │ ├── local.php.dist
│ │ ├── user.global.php
│ │ ├── zf-mvc-auth-oauth2-override.global.php
│ │ └── zfconfig.global.php
│ ├── development.config.php.dist
│ └── modules.config.php
├── data/
│ └── cache/
│ └── .gitkeep
├── docker-compose.yml
├── module/
│ └── Application/
│ ├── config/
│ │ └── module.config.php
│ ├── src/
│ │ ├── Controller/
│ │ │ └── IndexController.php
│ │ └── Module.php
│ ├── test/
│ │ └── Controller/
│ │ ├── IndexControllerTest.php
│ │ └── ZZIndexControllerDevModeTest.php
│ └── view/
│ ├── application/
│ │ └── index/
│ │ └── index.phtml
│ ├── error/
│ │ ├── 404.phtml
│ │ └── index.phtml
│ └── layout/
│ └── layout.phtml
├── phpcs.xml
├── phpunit.xml.dist
├── public/
│ ├── .gitignore
│ ├── .htaccess
│ ├── index.php
│ └── web.config
└── src/
└── Apigility/
└── constants.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .dockerignore
================================================
nbproject
._*
.~lock.*
.buildpath
.DS_Store
.idea
.project
.settings
vendor/
public/vendor/
config/development.config.php
config/autoload/local.php
config/autoload/*.local.php
!public/vendor/README.md
data/cache/*
!data/cache/.gitkeep
================================================
FILE: .gitignore
================================================
.vagrant/
vendor/
config/development.config.php
data/cache/*
!data/cache/.gitkeep
phpunit.xml
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.5.3 - TBD
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 1.5.2 - 2019-01-09
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#168](https://github.com/zfcampus/zf-apigility-skeleton/pull/168) fixes file permissions of the `/var/www` folder when using Vagrant,
setting them to the `www-data` user.
## 1.5.1 - 2018-08-15
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#165](https://github.com/zfcampus/zf-apigility-skeleton/pull/165) updates the `composer.lock` by running `composer install` using a
PHP 5.6 release. This was done as the 1.5.0 release was made using a PHP 7.1+
binary, and thus installed versions of dependencies that were compatible with
those release - but not with 5.6. Once a release is made with this patch,
users on PHP 5.6 will be able to install the skeleton again.
However, this means that PHP 7.1+ users will need to execute the following
after an initial skeleton install in order to get newer versions of libraries
compatible with 7.1:
```bash
$ rm -Rf composer.lock vendor
$ composer install
```
## 1.5.0 - 2018-05-08
### Added
- [#159](https://github.com/zfcampus/zf-apigility-skeleton/pull/159) adds a development requirement on zendframework/zend-test, ensuring users
have the ability to run existing unit tests, as well as write and execute new ones out of the box.
### Changed
- [#164](https://github.com/zfcampus/zf-apigility-skeleton/pull/164) updates all dependencies to versions that will work with PHP 7.2, where possible.
- [#154](https://github.com/zfcampus/zf-apigility-skeleton/pull/154) modifies the `config/autoload/.gitignore` rules to omit `*.local-development.php` files.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Code of Conduct
This project adheres to [The Code Manifesto](http://codemanifesto.com)
as its guidelines for contributor interactions.
## The Code Manifesto
We want to work in an ecosystem that empowers developers to reach their
potential — one that encourages growth and effective collaboration. A space that
is safe for all.
A space such as this benefits everyone that participates in it. It encourages
new developers to enter our field. It is through discussion and collaboration
that we grow, and through growth that we improve.
In the effort to create such a place, we hold to these values:
1. **Discrimination limits us.** This includes discrimination on the basis of
race, gender, sexual orientation, gender identity, age, nationality, technology
and any other arbitrary exclusion of a group of people.
2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort
levels. Remember that, and if brought to your attention, heed it.
3. **We are our biggest assets.** None of us were born masters of our trade.
Each of us has been helped along the way. Return that favor, when and where
you can.
4. **We are resources for the future.** As an extension of #3, share what you
know. Make yourself a resource to help those that come after you.
5. **Respect defines us.** Treat others as you wish to be treated. Make your
discussions, criticisms and debates from a position of respectfulness. Ask
yourself, is it true? Is it necessary? Is it constructive? Anything less is
unacceptable.
6. **Reactions require grace.** Angry responses are valid, but abusive language
and vindictive actions are toxic. When something happens that offends you,
handle it assertively, but be respectful. Escalate reasonably, and try to
allow the offender an opportunity to explain themselves, and possibly correct
the issue.
7. **Opinions are just that: opinions.** Each and every one of us, due to our
background and upbringing, have varying opinions. The fact of the matter, is
that is perfectly acceptable. Remember this: if you respect your own
opinions, you should respect the opinions of others.
8. **To err is human.** You might not intend it, but mistakes do happen and
contribute to build experience. Tolerate honest mistakes, and don't hesitate
to apologize if you make one yourself.
================================================
FILE: CONTRIBUTING.md
================================================
# CONTRIBUTING
## RESOURCES
If you wish to contribute to this project, please be sure to
read/subscribe to the following resources:
- [Coding Standards](https://github.com/zendframework/zend-coding-standard)
- [Forums](https://discourse.zendframework.com/c/contributors)
- [Chat](https://zendframework-slack.herokuapp.com)
- [Code of Conduct](CODE_OF_CONDUCT.md)
If you are working on new features or refactoring
[create a proposal](https://github.com/zfcampus/zf-api-problem/issues/new).
## RUNNING TESTS
To run tests:
- Clone the repository:
```console
$ git clone git://github.com/zfcampus/zf-api-problem.git
$ cd zf-api-problem
```
- Install dependencies via composer:
```console
$ composer install
```
If you don't have `composer` installed, please download it from https://getcomposer.org/download/
- Make sure that `zendframework/zend-test` is installed:
```console
$ composer require --dev zendframework/zend-test
```
- Run the tests using the "test" command shipped in the `composer.json`:
```console
$ composer test
```
You can turn on conditional tests with the `phpunit.xml` file.
To do so:
- Copy `phpunit.xml.dist` file to `phpunit.xml`
- Edit `phpunit.xml` to enable any specific functionality you
want to test, as well as to provide test values to utilize.
## Running Coding Standards Checks
First, ensure you've installed dependencies via composer, per the previous
section on running tests.
Make sure that `squizlabs/php_codesniffer` is installed:
```console
$ composer require --dev squizlabs/php_codesniffer
```
To run CS checks only:
```console
$ composer cs-check
```
To attempt to automatically fix common CS issues:
```console
$ composer cs-fix
```
If the above fixes any CS issues, please re-run the tests to ensure
they pass, and make sure you add and commit the changes after verification.
## Recommended Workflow for Contributions
Your first step is to establish a public repository from which we can
pull your work into the master repository. We recommend using
[GitHub](https://github.com), as that is where the component is already hosted.
1. Setup a [GitHub account](https://github.com/), if you haven't yet
2. Fork the repository (https://github.com/zfcampus/zf-api-problem)
3. Clone the canonical repository locally and enter it.
```console
$ git clone git://github.com/zfcampus/zf-api-problem.git
$ cd zf-api-problem
```
4. Add a remote to your fork; substitute your GitHub username in the command
below.
```console
$ git remote add {username} git@github.com:{username}/zf-api-problem.git
$ git fetch {username}
```
### Keeping Up-to-Date
Periodically, you should update your fork or personal repository to
match the canonical ZF repository. Assuming you have setup your local repository
per the instructions above, you can do the following:
```console
$ git checkout master
$ git fetch origin
$ git rebase origin/master
# OPTIONALLY, to keep your remote up-to-date -
$ git push {username} master:master
```
If you're tracking other branches -- for example, the "develop" branch, where
new feature development occurs -- you'll want to do the same operations for that
branch; simply substitute "develop" for "master".
### Working on a patch
We recommend you do each new feature or bugfix in a new branch. This simplifies
the task of code review as well as the task of merging your changes into the
canonical repository.
A typical workflow will then consist of the following:
1. Create a new local branch based off either your master or develop branch.
2. Switch to your new local branch. (This step can be combined with the
previous step with the use of `git checkout -b`.)
3. Do some work, commit, repeat as necessary.
4. Push the local branch to your remote repository.
5. Send a pull request.
The mechanics of this process are actually quite trivial. Below, we will
create a branch for fixing an issue in the tracker.
```console
$ git checkout -b hotfix/9295
Switched to a new branch 'hotfix/9295'
```
... do some work ...
```console
$ git commit
```
... write your log message ...
```console
$ git push {username} hotfix/9295:hotfix/9295
Counting objects: 38, done.
Delta compression using up to 2 threads.
Compression objects: 100% (18/18), done.
Writing objects: 100% (20/20), 8.19KiB, done.
Total 20 (delta 12), reused 0 (delta 0)
To ssh://git@github.com/{username}/zf-api-problem.git
b5583aa..4f51698 HEAD -> master
```
To send a pull request, you have two options.
If using GitHub, you can do the pull request from there. Navigate to
your repository, select the branch you just created, and then select the
"Pull Request" button in the upper right. Select the user/organization
"zfcampus" (or whatever the upstream organization is) as the recipient.
#### What branch to issue the pull request against?
Which branch should you issue a pull request against?
- For fixes against the stable release, issue the pull request against the
"master" branch.
- For new features, or fixes that introduce new elements to the public API (such
as new public methods or properties), issue the pull request against the
"develop" branch.
### Branch Cleanup
As you might imagine, if you are a frequent contributor, you'll start to
get a ton of branches both locally and on your remote.
Once you know that your changes have been accepted to the master
repository, we suggest doing some cleanup of these branches.
- Local branch cleanup
```console
$ git branch -d <branchname>
```
- Remote branch removal
```console
$ git push {username} :<branchname>
```
================================================
FILE: Dockerfile
================================================
#
# Use this dockerfile to run apigility.
#
# Start the server using docker-compose:
#
# docker-compose build
# docker-compose up
#
# You can install dependencies via the container:
#
# docker-compose run apigility composer install
#
# You can manipulate dev mode from the container:
#
# docker-compose run apigility composer development-enable
# docker-compose run apigility composer development-disable
# docker-compose run apigility composer development-status
#
# OR use plain old docker
#
# docker build -f Dockerfile-dev -t apigility .
# docker run -it -p "8080:80" -v $PWD:/var/www apigility
#
FROM php:7.2-apache
RUN apt-get update \
&& apt-get install -y git zlib1g-dev \
&& docker-php-ext-install zip \
&& a2enmod rewrite \
&& sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf \
&& mv /var/www/html /var/www/public \
&& curl -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --filename=composer \
&& echo "AllowEncodedSlashes On" >> /etc/apache2/apache2.conf
WORKDIR /var/www
================================================
FILE: LICENSE.md
================================================
Copyright (c) 2013-2018, Zend Technologies USA, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: README.md
================================================
Apigility Skeleton Application
==============================
> ## Repository abandoned 2019-12-31
>
> This repository has moved to [laminas-api-tools/api-tools-skeleton](https://github.com/laminas-api-tools/api-tools-skeleton).
Requirements
------------
Please see the [composer.json](composer.json) file.
Installation
------------
### Via release tarball
Grab the latest release via the [Apigility website](http://apigility.org/)
and/or the [releases page](https://github.com/zfcampus/zf-apigility-skeleton/releases); each release
has distribution tarballs and zipballs available.
Untar it:
```bash
$ tar xzf zf-apigility-skeleton-{version}.tgz
```
(Where `{version}` is the version you downloaded.)
Or unzip, if you chose the zipball:
```bash
$ unzip zf-apigility-skeleton-{version}.zip
```
(Where `{version}` is the version you downloaded.)
### Via Composer (create-project)
You can use the `create-project` command from [Composer](http://getcomposer.org/)
to create the project in one go (you need to install [composer](https://getcomposer.org/doc/00-intro.md#downloading-the-composer-executable)):
```bash
$ curl -s https://getcomposer.org/installer | php -- --filename=composer
$ composer create-project -sdev zfcampus/zf-apigility-skeleton path/to/install
```
### Via Git (clone)
First, clone the repository:
```bash
# git clone https://github.com/zfcampus/zf-apigility-skeleton.git # optionally, specify the directory in which to clone
$ cd path/to/install
```
At this point, you need to use [Composer](https://getcomposer.org/) to install
dependencies. Assuming you already have Composer:
```bash
$ composer install
```
### All methods
Once you have the basic installation, you need to put it in development mode:
```bash
$ cd path/to/install
$ composer development-enable
```
Now, fire it up! Do one of the following:
- Create a vhost in your web server that points the DocumentRoot to the
`public/` directory of the project
- Fire up the built-in web server in PHP(**note**: do not use this for
production!)
In the latter case, do the following:
```bash
$ cd path/to/install
$ php -S 0.0.0.0:8080 -ddisplay_errors=0 -t public public/index.php
# OR use the composer alias:
$ composer serve
```
You can then visit the site at http://localhost:8080/ - which will bring up a
welcome page and the ability to visit the dashboard in order to create and
inspect your APIs.
### NOTE ABOUT USING APACHE
Apache forbids the character sequences `%2F` and `%5C` in URI paths. However, the Apigility Admin
API uses these characters for a number of service endpoints. As such, if you wish to use the
Admin UI and/or Admin API with Apache, you will need to configure your Apache vhost/project to
allow encoded slashes:
```apacheconf
AllowEncodedSlashes On
```
This change will need to be made in your server's vhost file (it cannot be added to `.htaccess`).
### NOTE ABOUT OPCACHE
**Disable all opcode caches when running the admin!**
The admin cannot and will not run correctly when an opcode cache, such as APC or
OpCache, is enabled. Apigility does not use a database to store configuration;
instead, it uses PHP configuration files. Opcode caches will cache these files
on first load, leading to inconsistencies as you write to them, and will
typically lead to a state where the admin API and code become unusable.
The admin is a **development** tool, and intended for use a development
environment. As such, you should likely disable opcode caching, regardless.
When you are ready to deploy your API to **production**, however, you can
disable development mode, thus disabling the admin interface, and safely run an
opcode cache again. Doing so is recommended for production due to the tremendous
performance benefits opcode caches provide.
### NOTE ABOUT DISPLAY_ERRORS
The `display_errors` `php.ini` setting is useful in development to understand what warnings,
notices, and error conditions are affecting your application. However, they cause problems for APIs:
APIs are typically a specific serialization format, and error reporting is usually in either plain
text, or, with extensions like XDebug, in HTML. This breaks the response payload, making it unusable
by clients.
For this reason, we recommend disabling `display_errors` when using the Apigility admin interface.
This can be done using the `-ddisplay_errors=0` flag when using the built-in PHP web server, or you
can set it in your virtual host or server definition. If you disable it, make sure you have
reasonable error log settings in place. For the built-in PHP web server, errors will be reported in
the console itself; otherwise, ensure you have an error log file specified in your configuration.
`display_errors` should *never* be enabled in production, regardless.
### Vagrant
If you prefer to develop with Vagrant, there is a basic vagrant recipe included with this project.
This recipe assumes that you already have Vagrant installed. The virtual machine will try to use localhost:8080 by
default, so if you already have a server on this port of your host machine, you need to shut down the conflicting
server first, or if you know how, you can reconfigure the ports in Vagrantfile.
Assuming you have Vagrant installed and assuming you have no port conflicts, you can bring up the Vagrant machine
with the standard `up` command:
```bash
$ vagrant up
```
When the machine comes up, you can ssh to it with the standard ssh forward agent:
```bash
$ vagrant ssh
```
The web root is inside the shared directory, which is at `/var/www`; this is
also the home directory for the vagrant issue, which will be the initial
directory you land in once you connect via SSH.
The image installs composer during provisioning, meaning you can use it to
install and update dependencies:
```bash
# Install dependencies:
$ vagrant ssh -c 'composer install'
# Update dependencies:
$ vagrant ssh -c 'composer update'
```
You can also manipulate development mode:
```bash
$ vagrant ssh -c 'composer development-enable'
$ vagrant ssh -c 'composer development-disable'
$ vagrant ssh -c 'composer development-status'
```
> #### Vagrant and VirtualBox
>
> The vagrant image is based on `bento/ubuntu-16.04`. If you are using VirtualBox as
> a provider, you will need:
>
> - Vagrant 1.8.5 or later
> - VirtualBox 5.0.26 or later
For vagrant documentation, please refer to [vagrantup.com](https://www.vagrantup.com/)
### Docker
If you develop or deploy using Docker, we provide configuration for you.
Prepare your development environment using [docker compose](https://docs.docker.com/compose/install/):
```bash
$ git clone https://github.com/zfcampus/zf-apigility-skeleton
$ cd zf-apigility-skeleton
$ docker-compose build
# Install dependencies via composer, if you haven't already:
$ docker-compose run apigility composer install
# Enable development mode:
$ docker-compose run apigility composer development-enable
```
Start the container:
```bash
$ docker-compose up
```
Access Apigility from `http://localhost:8080/` or `http://<boot2docker ip>:8080/` if on Windows or Mac.
You may also use the provided `Dockerfile` directly if desired.
Once installed, you can use the container to update dependencies:
```bash
$ docker-compose run apigility composer update
```
Or to manipulate development mode:
```bash
$ docker-compose run apigility composer development-enable
$ docker-compose run apigility composer development-disable
$ docker-compose run apigility composer development-status
```
QA Tools
--------
The skeleton ships with minimal QA tooling by default, including
zendframework/zend-test. We supply basic tests for the shipped
`Application\Controller\IndexController`.
We also ship with configuration for [phpcs](https://github.com/squizlabs/php_codesniffer).
If you wish to add this QA tool, execute the following:
```bash
$ composer require --dev squizlabs/php_codesniffer
```
We provide aliases for each of these tools in the Composer configuration:
```bash
# Run CS checks:
$ composer cs-check
# Fix CS errors:
$ composer cs-fix
# Run PHPUnit tests:
$ composer test
```
================================================
FILE: SUPPORT.md
================================================
# Getting Support
Zend Framework offers three support channels:
- For real-time questions, use our
[chat](https://zendframework-slack.herokuapp.com)
- For detailed questions (e.g., those requiring examples) use our
[forums](https://discourse.zendframework.com/c/questions/apigility)
- To report issues, use this repository's
[issue tracker](https://github.com/zfcampus/zf-apigility-skeleton/issues/new)
**DO NOT** use the issue tracker to ask questions; use chat or the forums for
that. Questions posed to the issue tracker will be closed.
When reporting an issue, please include the following details:
- A narrative description of what you are trying to accomplish.
- The minimum code necessary to reproduce the issue.
- The expected results of exercising that code.
- The actual results received.
We may ask for additional details: what version of the library you are using,
and what PHP version was used to reproduce the issue.
You may also submit a failing test case as a pull request.
================================================
FILE: Vagrantfile
================================================
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
@script = <<SCRIPT
# Install dependencies
apt-get update
apt-get install -y apache2 git curl php7.0 php7.0-bcmath php7.0-bz2 php7.0-cli php7.0-curl php7.0-intl php7.0-json php7.0-mbstring php7.0-opcache php7.0-soap php7.0-sqlite3 php7.0-xml php7.0-xsl php7.0-zip libapache2-mod-php7.0
# Configure Apache
echo "<VirtualHost *:80>
DocumentRoot /var/www/public
AllowEncodedSlashes On
<Directory /var/www/public>
Options +Indexes +FollowSymLinks
DirectoryIndex index.php index.html
Order allow,deny
Allow from all
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>" > /etc/apache2/sites-available/000-default.conf
a2enmod rewrite
service apache2 restart
if [ -e /usr/local/bin/composer ]; then
/usr/local/bin/composer self-update
else
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
fi
# Reset home directory of vagrant user
if ! grep -q "cd /var/www" /home/vagrant/.profile; then
echo "cd /var/www" >> /home/vagrant/.profile
fi
echo "** [ZF] Run the following command to install dependencies, if you have not already:"
echo " vagrant ssh -c 'composer install'"
echo "** [ZF] Visit http://localhost:8080 in your browser for to view the application **"
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'bento/ubuntu-16.04'
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.synced_folder '.', '/var/www', owner: "www-data", group: "www-data"
config.vm.provision 'shell', inline: @script
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--name", "Apigility - Ubuntu 16.04"]
end
end
================================================
FILE: composer.json
================================================
{
"name": "zfcampus/zf-apigility-skeleton",
"description": "Skeleton Application for Apigility",
"type": "project",
"license": "BSD-3-Clause",
"keywords": [
"api",
"apigility",
"framework",
"zf",
"zendframework"
],
"homepage": "http://apigility.org/",
"support": {
"issues": "https://github.com/zfcampus/zf-apigility-skeleton/issues",
"source": "https://github.com/zfcampus/zf-apigility-skeleton",
"rss": "https://github.com/zfcampus/zf-apigility-skeleton/releases.atom",
"chat": "https://zendframework-slack.herokuapp.com",
"forum": "https://discourse.zendframework.com/c/questions/apigility"
},
"config": {
"process-timeout": 5000
},
"extra": {
"branch-alias": {
"dev-master": "1.5.x-dev",
"dev-develop": "1.6.x-dev"
}
},
"require": {
"php": "^5.6 || ^7.0",
"zendframework/zend-component-installer": "^1.1.1 || ^2.1.1",
"zfcampus/zf-apigility": "^1.4",
"zfcampus/zf-apigility-documentation": "^1.3",
"zfcampus/zf-development-mode": "^3.2"
},
"require-dev": {
"zendframework/zend-developer-tools": "^1.2.1",
"zendframework/zend-test": "^2.6.1 || ^3.2",
"zfcampus/zf-apigility-admin": "^1.6",
"zfcampus/zf-asset-manager": "^1.2",
"zfcampus/zf-composer-autoloading": "^1.1.1 || ^2.1",
"zfcampus/zf-deploy": "^1.3"
},
"suggest": {
"zfcampus/zf-apigility-doctrine": "zfcampus/zf-apigility-doctrine ^2.2 to create Doctrine-Connected REST services",
"zfcampus/zf-http-cache": "zfcampus/zf-http-cache ^1.4 to add HTTP caching to your API",
"zfr/zfr-cors": "zfr/zfr-cors ^1.5 to add CORS support to your API"
},
"autoload": {
"psr-4": {
"Application\\": "module/Application/src/"
}
},
"autoload-dev": {
"psr-4": {
"ApplicationTest\\": "module/Application/test/"
},
"files": [
"src/Apigility/constants.php"
]
},
"scripts": {
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"development-disable": "zf-development-mode disable",
"development-enable": "zf-development-mode enable",
"development-status": "zf-development-mode status",
"post-create-project-cmd": ["@development-enable"],
"serve": "php -S 0.0.0.0:8080 -t public/",
"test": "phpunit"
}
}
================================================
FILE: config/application.config.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
return [
// Retrieve the list of modules for this application.
'modules' => include __DIR__ . '/modules.config.php',
// This should be an array of paths in which modules reside.
// If a string key is provided, the listener will consider that a module
// namespace, the value of that key the specific path to that module's
// Module class.
'module_listener_options' => [
'module_paths' => [
'./module',
'./vendor'
],
// Using __DIR__ to ensure cross-platform compatibility. Some platforms --
// e.g., IBM i -- have problems with globs that are not qualified.
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}.php'],
'config_cache_key' => 'application.config.cache',
'config_cache_enabled' => true,
'module_map_cache_key' => 'application.module.cache',
'module_map_cache_enabled' => true,
'cache_dir' => 'data/cache/',
],
];
================================================
FILE: config/autoload/.gitignore
================================================
local.php
local-development.php
*.local.php
*.local-development.php
================================================
FILE: config/autoload/README.md
================================================
About this directory:
=====================
By default, this application is configured to load all configs in
`./config/autoload/{,*.}{global,local}.php`. Doing this provides a
location for a developer to drop in configuration override files provided by
modules, as well as cleanly provide individual, application-wide config files
for things like database connections, etc.
================================================
FILE: config/autoload/global-development.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
use ZF\Apigility\Admin\Model\ModulePathSpec;
return [
'view_manager' => [
'display_exceptions' => true,
],
'zf-apigility-admin' => [
'path_spec' => ModulePathSpec::PSR_4,
],
'zf-configuration' => [
'enable_short_array' => true,
'class_name_scalars' => true,
],
];
================================================
FILE: config/autoload/global.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c] 2014-2016 Zend Technologies USA Inc. (http://www.zend.com]
*/
return [
'zf-content-negotiation' => [
'selectors' => [],
],
'db' => [
'adapters' => [
'dummy' => [],
],
],
];
================================================
FILE: config/autoload/local.php.dist
================================================
<?php
/**
* Local Configuration Override
*
* This configuration override file is for overriding environment-specific and
* security-sensitive configuration information. Copy this file without the
* .dist extension at the end and populate values as needed.
*
* @NOTE: This file is ignored from Git by default with the .gitignore included
* in ZendSkeletonApplication. This is a good practice, as it prevents sensitive
* credentials from accidentally being committed into version control.
*/
return [];
================================================
FILE: config/autoload/user.global.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
*/
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/
return [
// ...
];
================================================
FILE: config/autoload/zf-mvc-auth-oauth2-override.global.php
================================================
<?php
/**
* This file was autogenerated by zfcampus/zf-mvc-auth (bin/zf-mvc-auth-oauth2-override.php),
* and overrides the ZF\OAuth2\Service\OAuth2Server to provide the ability to create named
* OAuth2\Server instances.
*/
return [
'service_manager' => [
'factories' => [
\ZF\OAuth2\Service\OAuth2Server::class => \ZF\MvcAuth\Factory\NamedOAuth2ServerFactory::class,
],
],
];
================================================
FILE: config/autoload/zfconfig.global.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
*/
return [
'view_manager' => [
'strategies' => [
'ViewJsonStrategy',
],
],
];
================================================
FILE: config/development.config.php.dist
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
return [
// Development time modules
'modules' => [
'ZendDeveloperTools',
'ZF\Apigility\Admin',
],
// development time configuration globbing
'module_listener_options' => [
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}-development.php'],
'config_cache_enabled' => false,
'module_map_cache_enabled' => false,
],
];
================================================
FILE: config/modules.config.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
/**
* List of enabled modules for this application.
*/
return [
'Zend\Db',
'Zend\Filter',
'Zend\Hydrator',
'Zend\InputFilter',
'Zend\Paginator',
'Zend\Router',
'Zend\Validator',
'ZF\Apigility',
'ZF\Apigility\Documentation',
'ZF\ApiProblem',
'ZF\Configuration',
'ZF\OAuth2',
'ZF\MvcAuth',
'ZF\Hal',
'ZF\ContentNegotiation',
'ZF\ContentValidation',
'ZF\Rest',
'ZF\Rpc',
'ZF\Versioning',
'Application',
];
================================================
FILE: data/cache/.gitkeep
================================================
================================================
FILE: docker-compose.yml
================================================
version: "2"
services:
apigility:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:80"
volumes:
- .:/var/www
================================================
FILE: module/Application/config/module.config.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace Application;
use Zend\ServiceManager\Factory\InvokableFactory;
return [
'router' => [
'routes' => [
'home' => [
'type' => 'Literal',
'options' => [
'route' => '/',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
],
],
],
'controllers' => [
'factories' => [
Controller\IndexController::class => InvokableFactory::class,
],
],
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => [
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
];
================================================
FILE: module/Application/src/Controller/IndexController.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use ZF\Apigility\Admin\Module as AdminModule;
class IndexController extends AbstractActionController
{
public function indexAction()
{
if (class_exists(AdminModule::class, false)) {
return $this->redirect()->toRoute('zf-apigility/ui');
}
return new ViewModel();
}
}
================================================
FILE: module/Application/src/Module.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace Application;
class Module
{
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
}
================================================
FILE: module/Application/test/Controller/IndexControllerTest.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace ApplicationTest\Controller;
use Application\Controller\IndexController;
use Zend\Stdlib\ArrayUtils;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class IndexControllerTest extends AbstractHttpControllerTestCase
{
public function setUp()
{
// The module configuration should still be applicable for tests.
// You can override configuration here with test case specific values,
// such as sample view templates, path stacks, module_listener_options,
// etc.
$configOverrides = [
'module_listener_options' => [
'config_cache_enabled' => false,
],
];
$this->setApplicationConfig(ArrayUtils::merge(
include __DIR__ . '/../../../../config/application.config.php',
$configOverrides
));
parent::setUp();
}
public function testIndexActionCanBeAccessed()
{
$this->dispatch('/', 'GET');
$this->assertResponseStatusCode(200);
$this->assertModuleName('application');
$this->assertControllerName(IndexController::class); // as specified in router's controller name alias
$this->assertControllerClass('IndexController');
$this->assertMatchedRouteName('home');
}
public function testIndexActionViewModelTemplateRenderedWithinLayout()
{
$this->dispatch('/', 'GET');
$this->assertQuery('.hero-unit');
}
public function testInvalidRouteDoesNotCrash()
{
$this->dispatch('/invalid/route', 'GET');
$this->assertResponseStatusCode(404);
}
}
================================================
FILE: module/Application/test/Controller/ZZIndexControllerDevModeTest.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace ApplicationTest\Controller;
use Application\Controller\IndexController;
use Zend\Stdlib\ArrayUtils;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
/**
* Name is intentional, to force it to run last; this was necessary as,
* once the Admin module is loaded, the controller is able to find it and
* will attempt the redirect.
*/
class ZZIndexControllerDevModeTest extends AbstractHttpControllerTestCase
{
public function setUp()
{
// The module configuration should still be applicable for tests.
// You can override configuration here with test case specific values,
// such as sample view templates, path stacks, module_listener_options,
// etc.
$configOverrides = [
'modules' => [
'ZF\Apigility\Admin',
'ZF\Apigility\Admin\Ui',
],
'module_listener_options' => [
'config_cache_enabled' => false,
'config_glob_paths' => [
__DIR__ . '/../../../../config/autoload/{,*.}{global,local}.php',
__DIR__ . '/../../../../config/autoload/{,*.}{global,local}-development.php',
],
]
];
$this->setApplicationConfig(ArrayUtils::merge(
include __DIR__ . '/../../../../config/application.config.php',
$configOverrides
));
parent::setUp();
}
public function testIndexActionRedirectsToAdminUi()
{
$this->dispatch('/', 'GET');
$this->assertResponseStatusCode(302);
$this->assertRedirectRegex('#/ui$#');
}
}
================================================
FILE: module/Application/view/application/index/index.phtml
================================================
<div class="hero-unit">
<p align="center"><img src="/img/ag-hero.png" alt="Apigility <?= \Apigility\VERSION ?>"></p>
</div>
<div class="row">
<div class="span8">
<p><br /><br />In order to use the <strong>Apigility Admin UI</strong> you need to enable the <strong>development</strong> mode. Currently your application is running in <strong>production</strong> mode.</p>
<p>To enable the development mode you can execute the following command from the terminal:</p>
<p><pre>$ composer development-enable</pre></p>
<p>Remember to set always the production mode if you want to deploy your API in a staging/production environment.</p>
</div>
</div>
================================================
FILE: module/Application/view/error/404.phtml
================================================
<?php
use Zend\Mvc\Application;
?>
<h1>A 404 error occurred</h1>
<h2><?= $this->message ?></h2>
<?php
if (! empty($this->reason)) :
$reasonMessage = '';
switch ($this->reason) {
case Application::ERROR_CONTROLLER_CANNOT_DISPATCH:
$reasonMessage = 'The requested controller was unable to dispatch the request.';
break;
case Application::ERROR_MIDDLEWARE_CANNOT_DISPATCH:
$reasonMessage = 'The requested middleware was unable to dispatch the request.';
break;
case Application::ERROR_CONTROLLER_NOT_FOUND:
$reasonMessage = 'The requested controller could not be mapped to an existing controller class.';
break;
case Application::ERROR_CONTROLLER_INVALID:
$reasonMessage = 'The requested controller was not dispatchable.';
break;
case Application::ERROR_ROUTER_NO_MATCH:
$reasonMessage = 'The requested URL could not be matched by routing.';
break;
default:
$reasonMessage = 'We cannot determine at this time why a 404 was generated.';
break;
}
?>
<p><?= $reasonMessage ?></p>
<?php endif ?>
<?php if (! empty($this->controller)) : ?>
<dl>
<dt>Controller:</dt>
<dd><?= $this->escapeHtml($this->controller) ?>
<?php
if (! empty($this->controller_class)
&& $this->controller_class != $this->controller
) {
echo sprintf('(resolves to %s)', $this->escapeHtml($this->controller_class));
}
?>
</dd>
</dl>
<?php endif ?>
<?php if (! empty($this->display_exceptions)) : ?>
<?php if (isset($this->exception)
&& ($this->exception instanceof \Throwable || $this->exception instanceof \Exception)) : ?>
<hr/>
<h2>Additional information:</h2>
<h3><?= get_class($this->exception) ?></h3>
<dl>
<dt>File:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->exception->getFile() ?>:<?= $this->exception->getLine() ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->escapeHtml($this->exception->getMessage()) ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->exception->getTraceAsString() ?></pre>
</dd>
</dl>
<?php $e = $this->exception->getPrevious() ?>
<?php if ($e) : ?>
<hr/>
<h2>Previous exceptions:</h2>
<ul class="unstyled">
<?php while ($e) : ?>
<li>
<h3><?= get_class($e) ?></h3>
<dl>
<dt>File:</dt>
<dd>
<pre class="prettyprint linenums"><?= $e->getFile() ?>:<?= $e->getLine() ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->escapeHtml($e->getMessage()) ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre class="prettyprint linenums"><?= $e->getTraceAsString() ?></pre>
</dd>
</dl>
</li>
<?php $e = $e->getPrevious() ?>
<?php endwhile ?>
</ul>
<?php endif ?>
<?php else : ?>
<h3>No Exception available</h3>
<?php endif ?>
<?php endif ?>
================================================
FILE: module/Application/view/error/index.phtml
================================================
<h1>An error occurred</h1>
<h2><?= $this->message ?></h2>
<?php if (! empty($this->display_exceptions)) : ?>
<?php if (isset($this->exception)
&& ($this->exception instanceof \Throwable || $this->exception instanceof \Exception)) : ?>
<hr/>
<h2>Additional information:</h2>
<h3><?= get_class($this->exception) ?></h3>
<dl>
<dt>File:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->exception->getFile() ?>:<?= $this->exception->getLine() ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->escapeHtml($this->exception->getMessage()) ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->exception->getTraceAsString() ?></pre>
</dd>
</dl>
<?php $e = $this->exception->getPrevious() ?>
<?php if ($e) : ?>
<hr/>
<h2>Previous exceptions:</h2>
<ul class="unstyled">
<?php while ($e) : ?>
<li>
<h3><?= get_class($e); ?></h3>
<dl>
<dt>File:</dt>
<dd>
<pre class="prettyprint linenums"><?= $e->getFile() ?>:<?= $e->getLine() ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre class="prettyprint linenums"><?= $this->escapeHtml($e->getMessage()) ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre class="prettyprint linenums"><?= $e->getTraceAsString() ?></pre>
</dd>
</dl>
</li>
<?php $e = $e->getPrevious() ?>
<?php endwhile ?>
</ul>
<?php endif ?>
<?php else : ?>
<h3>No Exception available</h3>
<?php endif ?>
<?php endif ?>
================================================
FILE: module/Application/view/layout/layout.phtml
================================================
<?= $this->doctype() ?>
<html lang="en">
<head>
<meta charset="utf-8">
<?php
echo $this->headTitle('Apigility');
echo $this->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0');
echo $this->headLink(['rel' => 'icon', 'type' => 'image/png', 'href' => $this->basePath('/img/favicon.png')])
->prependStylesheet($this->basePath('/zf-apigility/css/main.min.css'))
->prependStylesheet($this->basePath('/zf-apigility/css/bootstrap.min.css'));
echo $this->headScript()
->prependFile($this->basePath('/zf-apigility/js/bootstrap.min.js'))
->prependFile($this->basePath('/zf-apigility/js/jquery.min.js'));
?>
</head>
<body>
<div class="container">
<?= $this->content ?>
</div>
<footer>
<hr>
<div class="container center-block"><div class="row">
<div class="col-sm-4">
© Copyright 2013 - <?= date('Y') ?>
by <a href="http://www.zend.com">Zend Technologies</a> Ltd.
</div>
<div class="col-sm-4"><p class="center-block">
Apigility version <strong><?= \Apigility\VERSION ?></strong>
</p></div>
<div class="col-sm-4"><p class="pull-right">
For more information <a href="https://apigility.org">apigility.org</a>
</p></div>
</div></div>
</footer>
<?= $this->inlineScript() ?>
</body>
</html>
================================================
FILE: phpcs.xml
================================================
<?xml version="1.0"?>
<ruleset name="Zend Framework coding standard">
<description>Zend Framework coding standard</description>
<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>
<arg name="extensions" value="php,dist,phtml"/>
<!-- inherit rules from: -->
<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Formatting.SpaceAfterNot"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>public/index.php</exclude-pattern>
</rule>
<!-- Paths to check -->
<file>config</file>
<file>module</file>
<file>public/index.php</file>
<file>src</file>
</ruleset>
================================================
FILE: phpunit.xml.dist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="zf-apigility-skeleton">
<directory>./module/Application/test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./module/Application/src</directory>
</whitelist>
</filter>
</phpunit>
================================================
FILE: public/.gitignore
================================================
apigility-ui/
zf-apigility/
================================================
FILE: public/.htaccess
================================================
RewriteEngine On
# The following rule allows authentication to work with fast-cgi
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
================================================
FILE: public/index.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
use Zend\Stdlib\ArrayUtils;
use ZF\Apigility\Application;
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Redirect legacy requests to enable/disable development mode to new tool
if (php_sapi_name() === 'cli'
&& $argc > 2
&& 'development' == $argv[1]
&& in_array($argv[2], ['disable', 'enable'])
) {
// Windows needs to execute the batch scripts that Composer generates,
// and not the Unix shell version.
$script = defined('PHP_WINDOWS_VERSION_BUILD') && constant('PHP_WINDOWS_VERSION_BUILD')
? '.\\vendor\\bin\\zf-development-mode.bat'
: './vendor/bin/zf-development-mode';
system(sprintf('%s %s', $script, $argv[2]), $return);
exit($return);
}
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
}
if (! file_exists('vendor/autoload.php')) {
throw new RuntimeException(
'Unable to load application.' . PHP_EOL
. '- Type `composer install` if you are developing locally.' . PHP_EOL
. '- Type `vagrant ssh -c \'composer install\'` if you are using Vagrant.' . PHP_EOL
. '- Type `docker-compose run apigility composer install` if you are using Docker.'
);
}
// Setup autoloading
include 'vendor/autoload.php';
$appConfig = include 'config/application.config.php';
if (file_exists('config/development.config.php')) {
$appConfig = ArrayUtils::merge(
$appConfig,
include 'config/development.config.php'
);
}
// Run the application!
Application::init($appConfig)->run();
================================================
FILE: public/web.config
================================================
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^.*$" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}"
matchType="IsFile" pattern=""
ignoreCase="false" />
<add input="{REQUEST_FILENAME}"
matchType="IsDirectory"
pattern=""
ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^.*$" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
================================================
FILE: src/Apigility/constants.php
================================================
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
namespace Apigility;
const VERSION = '1.5.1dev';
gitextract_1rl9e0ja/
├── .dockerignore
├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE.md
├── README.md
├── SUPPORT.md
├── Vagrantfile
├── composer.json
├── config/
│ ├── application.config.php
│ ├── autoload/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── global-development.php
│ │ ├── global.php
│ │ ├── local.php.dist
│ │ ├── user.global.php
│ │ ├── zf-mvc-auth-oauth2-override.global.php
│ │ └── zfconfig.global.php
│ ├── development.config.php.dist
│ └── modules.config.php
├── data/
│ └── cache/
│ └── .gitkeep
├── docker-compose.yml
├── module/
│ └── Application/
│ ├── config/
│ │ └── module.config.php
│ ├── src/
│ │ ├── Controller/
│ │ │ └── IndexController.php
│ │ └── Module.php
│ ├── test/
│ │ └── Controller/
│ │ ├── IndexControllerTest.php
│ │ └── ZZIndexControllerDevModeTest.php
│ └── view/
│ ├── application/
│ │ └── index/
│ │ └── index.phtml
│ ├── error/
│ │ ├── 404.phtml
│ │ └── index.phtml
│ └── layout/
│ └── layout.phtml
├── phpcs.xml
├── phpunit.xml.dist
├── public/
│ ├── .gitignore
│ ├── .htaccess
│ ├── index.php
│ └── web.config
└── src/
└── Apigility/
└── constants.php
SYMBOL INDEX (12 symbols across 4 files)
FILE: module/Application/src/Controller/IndexController.php
class IndexController (line 13) | class IndexController extends AbstractActionController
method indexAction (line 15) | public function indexAction()
FILE: module/Application/src/Module.php
class Module (line 9) | class Module
method getConfig (line 11) | public function getConfig()
FILE: module/Application/test/Controller/IndexControllerTest.php
class IndexControllerTest (line 13) | class IndexControllerTest extends AbstractHttpControllerTestCase
method setUp (line 15) | public function setUp()
method testIndexActionCanBeAccessed (line 35) | public function testIndexActionCanBeAccessed()
method testIndexActionViewModelTemplateRenderedWithinLayout (line 45) | public function testIndexActionViewModelTemplateRenderedWithinLayout()
method testInvalidRouteDoesNotCrash (line 51) | public function testInvalidRouteDoesNotCrash()
FILE: module/Application/test/Controller/ZZIndexControllerDevModeTest.php
class ZZIndexControllerDevModeTest (line 18) | class ZZIndexControllerDevModeTest extends AbstractHttpControllerTestCase
method setUp (line 20) | public function setUp()
method testIndexActionRedirectsToAdminUi (line 48) | public function testIndexActionRedirectsToAdminUi()
Condensed preview — 40 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (55K chars).
[
{
"path": ".dockerignore",
"chars": 235,
"preview": "nbproject\n._*\n.~lock.*\n.buildpath\n.DS_Store\n.idea\n.project\n.settings\nvendor/\npublic/vendor/\nconfig/development.config.ph"
},
{
"path": ".gitignore",
"chars": 94,
"preview": ".vagrant/\nvendor/\nconfig/development.config.php\ndata/cache/*\n!data/cache/.gitkeep\nphpunit.xml\n"
},
{
"path": "CHANGELOG.md",
"chars": 2083,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file, in reverse chronological order by rele"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 2360,
"preview": "# Contributor Code of Conduct\n\nThis project adheres to [The Code Manifesto](http://codemanifesto.com)\nas its guidelines "
},
{
"path": "CONTRIBUTING.md",
"chars": 5642,
"preview": "# CONTRIBUTING\n\n## RESOURCES\n\nIf you wish to contribute to this project, please be sure to\nread/subscribe to the followi"
},
{
"path": "Dockerfile",
"chars": 1081,
"preview": "#\n# Use this dockerfile to run apigility.\n#\n# Start the server using docker-compose:\n#\n# docker-compose build\n# dock"
},
{
"path": "LICENSE.md",
"chars": 1516,
"preview": "Copyright (c) 2013-2018, Zend Technologies USA, Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary f"
},
{
"path": "README.md",
"chars": 8107,
"preview": "Apigility Skeleton Application\n==============================\n\n> ## Repository abandoned 2019-12-31\n>\n> This repository "
},
{
"path": "SUPPORT.md",
"chars": 1003,
"preview": "# Getting Support\n\nZend Framework offers three support channels:\n\n- For real-time questions, use our\n [chat](https://ze"
},
{
"path": "Vagrantfile",
"chars": 1861,
"preview": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\nVAGRANTFILE_API_VERSION = '2'\n\n@script = <<SCRIPT\n# Install dependencies\napt-g"
},
{
"path": "composer.json",
"chars": 2521,
"preview": "{\n \"name\": \"zfcampus/zf-apigility-skeleton\",\n \"description\": \"Skeleton Application for Apigility\",\n \"type\": \"pr"
},
{
"path": "config/application.config.php",
"chars": 1157,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "config/autoload/.gitignore",
"chars": 68,
"preview": "local.php\nlocal-development.php\n*.local.php\n*.local-development.php\n"
},
{
"path": "config/autoload/README.md",
"chars": 376,
"preview": "About this directory:\n=====================\n\nBy default, this application is configured to load all configs in\n`./config"
},
{
"path": "config/autoload/global-development.php",
"chars": 494,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "config/autoload/global.php",
"chars": 336,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c] 2014-2016 Z"
},
{
"path": "config/autoload/local.php.dist",
"chars": 512,
"preview": "<?php\n/**\n * Local Configuration Override\n *\n * This configuration override file is for overriding environment-specific "
},
{
"path": "config/autoload/user.global.php",
"chars": 587,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014 Zend T"
},
{
"path": "config/autoload/zf-mvc-auth-oauth2-override.global.php",
"chars": 416,
"preview": "<?php\n/**\n * This file was autogenerated by zfcampus/zf-mvc-auth (bin/zf-mvc-auth-oauth2-override.php),\n * and overrides"
},
{
"path": "config/autoload/zfconfig.global.php",
"chars": 280,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014 Zend T"
},
{
"path": "config/development.config.php.dist",
"chars": 580,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "config/modules.config.php",
"chars": 658,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "data/cache/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "docker-compose.yml",
"chars": 152,
"preview": "version: \"2\"\nservices:\n apigility:\n build:\n context: .\n dockerfile: Dockerfile\n ports:\n - \"8080:80\""
},
{
"path": "module/Application/config/module.config.php",
"chars": 1531,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "module/Application/src/Controller/IndexController.php",
"chars": 604,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "module/Application/src/Module.php",
"chars": 323,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "module/Application/test/Controller/IndexControllerTest.php",
"chars": 1786,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2016 Zend T"
},
{
"path": "module/Application/test/Controller/ZZIndexControllerDevModeTest.php",
"chars": 1804,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2016 Zend T"
},
{
"path": "module/Application/view/application/index/index.phtml",
"chars": 689,
"preview": "<div class=\"hero-unit\">\n <p align=\"center\"><img src=\"/img/ag-hero.png\" alt=\"Apigility <?= \\Apigility\\VERSION ?>\"></p>"
},
{
"path": "module/Application/view/error/404.phtml",
"chars": 3222,
"preview": "<?php\nuse Zend\\Mvc\\Application;\n?>\n<h1>A 404 error occurred</h1>\n<h2><?= $this->message ?></h2>\n\n<?php\nif (! empty($this"
},
{
"path": "module/Application/view/error/index.phtml",
"chars": 1716,
"preview": "<h1>An error occurred</h1>\n<h2><?= $this->message ?></h2>\n\n<?php if (! empty($this->display_exceptions)) : ?>\n\n <?php"
},
{
"path": "module/Application/view/layout/layout.phtml",
"chars": 1416,
"preview": "<?= $this->doctype() ?>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n<?php\necho $this->headTitle('Apigility');\n\nec"
},
{
"path": "phpcs.xml",
"chars": 1018,
"preview": "<?xml version=\"1.0\"?>\n<ruleset name=\"Zend Framework coding standard\">\n <description>Zend Framework coding standard</d"
},
{
"path": "phpunit.xml.dist",
"chars": 605,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:noNam"
},
{
"path": "public/.gitignore",
"chars": 28,
"preview": "apigility-ui/\nzf-apigility/\n"
},
{
"path": "public/.htaccess",
"chars": 838,
"preview": "RewriteEngine On\n# The following rule allows authentication to work with fast-cgi\nRewriteRule .* - [E=HTTP_AUTHORIZATION"
},
{
"path": "public/index.php",
"chars": 1901,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2014-2016 Z"
},
{
"path": "public/web.config",
"chars": 1027,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration>\n <system.webServer>\n <rewrite>\n <rules>\n "
},
{
"path": "src/Apigility/constants.php",
"chars": 218,
"preview": "<?php\n/**\n * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause\n * @copyright Copyright (c) 2016 Zend T"
}
]
About this extraction
This page contains the full source code of the zfcampus/zf-apigility-skeleton GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 40 files (49.7 KB), approximately 13.5k tokens, and a symbol index with 12 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.