Repository: aplus-framework/app
Branch: master
Commit: 962822556c48
Files: 74
Total size: 75.3 KB
Directory structure:
gitextract_403vn0ul/
├── .editorconfig
├── .github/
│ └── workflows/
│ └── tests.yml
├── .gitignore
├── .gitlab-ci.yml
├── .htaccess
├── .php-cs-fixer.dist.php
├── App.php
├── README.md
├── SECURITY.md
├── app/
│ ├── Commands/
│ │ └── Index.php
│ ├── Controllers/
│ │ └── Home.php
│ ├── Languages/
│ │ ├── en/
│ │ │ └── home.php
│ │ ├── es/
│ │ │ └── home.php
│ │ └── pt-br/
│ │ └── home.php
│ ├── Models/
│ │ └── .gitkeep
│ └── Views/
│ ├── _layouts/
│ │ └── default.php
│ ├── errors/
│ │ └── 404.php
│ └── home/
│ └── index.php
├── bin/
│ └── console
├── boot/
│ ├── app.php
│ ├── constants.php
│ ├── helpers.php
│ ├── init.php
│ └── routes.php
├── composer.json
├── config/
│ ├── antiCsrf.php
│ ├── autoloader.php
│ ├── cache.php
│ ├── console.php
│ ├── database.php
│ ├── debugger.php
│ ├── exceptionHandler.php
│ ├── language.php
│ ├── locator.php
│ ├── logger.php
│ ├── mailer.php
│ ├── migrator.php
│ ├── request.php
│ ├── response.php
│ ├── router.php
│ ├── session.php
│ ├── validation.php
│ └── view.php
├── docker-compose.yml
├── guide/
│ └── index.rst
├── php-server.ini
├── phpdoc.dist.xml
├── phpmd.xml
├── phpstan.neon.dist
├── phpunit.xml.dist
├── preload.php
├── public/
│ ├── .htaccess
│ ├── index.php
│ └── robots.txt
├── storage/
│ ├── cache/
│ │ └── .gitignore
│ ├── logs/
│ │ └── .gitignore
│ ├── sessions/
│ │ └── .gitignore
│ └── uploads/
│ └── .gitignore
└── tests/
├── AppTest.php
├── TestCase.php
├── app/
│ ├── Commands/
│ │ └── IndexTest.php
│ ├── Controllers/
│ │ └── HomeTest.php
│ └── Languages/
│ └── LanguagesTest.php
├── bin/
│ └── ConsoleTest.php
├── boot/
│ ├── AppTest.php
│ ├── ConstantsTest.php
│ ├── HelpersTest.php
│ ├── InitTest.php
│ └── RoutesTest.php
├── config/
│ └── ConfigsTest.php
├── public/
│ └── IndexTest.php
└── support/
├── Helpers/
│ └── tests.php
├── Models/
│ └── UsersModel.php
└── routes.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{md,rst}]
trim_trailing_whitespace = false
[*.yml]
indent_size = 2
================================================
FILE: .github/workflows/tests.yml
================================================
name: Tests
on:
push:
pull_request:
schedule:
- cron: '0 4 * * *'
jobs:
tests:
runs-on: ubuntu-24.04
timeout-minutes: 30
name: PHP 8.3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer
coverage: xdebug
- name: Install dependencies
run:
composer update
- name: Composer normalize
run:
composer normalize --dry-run --indent-size=4 --indent-style=space
- name: Coding Standard
run:
vendor/bin/php-cs-fixer fix --diff --dry-run --verbose
- name: PHPMD
run:
vendor/bin/phpmd app xml phpmd.xml
- name: PHPStan
run:
vendor/bin/phpstan analyse -vvv
- name: PHPUnit
run: vendor/bin/phpunit
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p build/logs/
cp build/coverage/clover.xml build/logs/clover.xml
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
tests-latest:
runs-on: ubuntu-24.04
timeout-minutes: 30
name: PHP Latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: latest
tools: composer
coverage: xdebug
- name: Install dependencies
run:
composer update
- name: PHPUnit
run: vendor/bin/phpunit
================================================
FILE: .gitignore
================================================
.config.php
.env
.env.php
.idea
.php-cs-fixer.cache
.phpunit.cache
.phpunit.result.cache
.vscode
build
composer.lock
composer.phar
phpstan.neon
phpunit.xml
raw-tests
vendor
================================================
FILE: .gitlab-ci.yml
================================================
---
image: registry.gitlab.com/aplus-framework/images/lempa:4
include:
- template: Security/SAST.gitlab-ci.yml
variables:
SAST_EXCLUDED_PATHS: guide, tests, vendor
test:php:
stage: test
timeout: 30 minutes
cache:
paths:
- vendor/
before_script:
- php -v
- composer update
script:
- composer normalize --dry-run --indent-size=4 --indent-style=space
- vendor/bin/php-cs-fixer fix --diff --dry-run --verbose
- vendor/bin/phpmd app xml phpmd.xml
- vendor/bin/phpstan analyse -vvv
- vendor/bin/phpunit --colors=never
- phpdoc
artifacts:
paths:
- build/coverage/
- build/docs/
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
test:php-latest:
image: registry.gitlab.com/aplus-framework/images/lempa:latest
stage: test
timeout: 30 minutes
cache:
paths:
- vendor/
before_script:
- php -v
- composer update
script:
- vendor/bin/phpunit --colors=never
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
pages:
stage: deploy
timeout: 10 minutes
dependencies:
- test:php
environment:
name: production
url: https://aplus-framework.gitlab.io
script:
- mv public/ app-public/
- mkdir public/
- mv build/coverage/ public/
- mv build/docs/ public/
artifacts:
paths:
- public/
only:
- master
================================================
FILE: .htaccess
================================================
Options All -Indexes
RewriteEngine On
# Redirect to the public directory
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
================================================
FILE: .php-cs-fixer.dist.php
================================================
setDefaultHeaderComment(
'App Project',
'' // [fullname] []
)->setFinder(
Finder::create()->in(__DIR__)->exclude('storage')
);
================================================
FILE: App.php
================================================
# Aplus Framework App Project
- [Home](https://aplus-framework.com/packages/app)
- [User Guide](https://docs.aplus-framework.com/guides/projects/app/index.html)
- [API Documentation](https://docs.aplus-framework.com/packages/app.html)
- [Online Demo](https://demo.aplus-framework.com)
[](https://github.com/aplus-framework/app/actions/workflows/tests.yml)
[](https://coveralls.io/github/aplus-framework/app?branch=master)
[](https://packagist.org/packages/aplus/app)
[](https://aplus-framework.com/sponsor)
## Getting Started
Make sure you have [Composer](https://getcomposer.org/doc/00-intro.md) installed.
Follow the installation instructions in the [User Guide](https://docs.aplus-framework.com/guides/projects/app/index.html).
To install the latest version:
```
composer create-project aplus/app
```
Or, to install the latest [LTS](https://aplus-framework.com/lts) version:
```
composer create-project aplus/app:^24
```
Enter the project directory.
---
Optionally, you can start a new project on GitHub from [this template](https://github.com/new?template_name=app&template_owner=aplus-framework).
## Licensing
Add a `LICENSE` file.
If you think about open-source your project,
[choose a license](https://choosealicense.com/licenses/).
If your project is proprietary, you can add your custom license or
[not](https://choosealicense.com/no-permission/).
Edit the `.php-cs-fixer.dist.php` file.
Set the project name and copyright information.
To update the comment header in all PHP files, run:
```
vendor/bin/php-cs-fixer fix -vvv
```
## Code Quality
Aplus Framework uses Code Quality Tools in all its projects.
By default, App Project also uses the following tools as dev-dependencies:
- [PHP-CS-Fixer](https://cs.symfony.com)
- [phpDocumentor](https://phpdoc.org)
- [PHPMD](https://phpmd.org)
- [PHPStan](https://phpstan.org)
- [PHPUnit](https://phpunit.de)
### Static Analysis
You can find bugs in your code without writing tests by running:
```
vendor/bin/phpstan analyse
```
See the `phpstan.neon.dist` file for more details.
### Mess Detector
You can look for several potential problems in the source code by running:
```
vendor/bin/phpmd app xml phpmd.xml
```
Customize your rules in the `phpmd.xml` file.
### Coding Standard
We extend PHP-CS-Fixer to create the
[Coding Standard Library](https://github.com/aplus-framework/coding-standard).
It is [PSR-12](https://www.php-fig.org/psr/psr-12/) compatible.
You can see what to fix in the source code by running:
```
vendor/bin/php-cs-fixer fix --diff --dry-run --verbose
```
### Testing
We extend PHPUnit to create the
[Testing Library](https://github.com/aplus-framework/testing).
You can unit test your code by running:
```
vendor/bin/phpunit
```
See the `phpunit.xml.dist` file for more details.
### Documenting
Good software usually has good documentation.
You can build beautiful HTML pages about your project's documentation.
You must have phpDocumentor installed on your computer or run `phpdoc`
[inside a container](#containers).
## Development Environment
The App Project is delivered with a dev-dependency to easily configure the
built-in PHP development server.
Just run
```
vendor/bin/php-server
```
and your project will be available at http://localhost:8080.
See the `php-server.ini` file for more details.
### Containers
Aplus has Docker [images](https://gitlab.com/aplus-framework/images) for testing
and building software.
You can run it in CI or local environments.
With [Docker](https://www.docker.com/get-started) installed on your computer,
you can run:
```
docker-compose run --service-ports lempa
```
This will log you as the **developer** user into a Docker container where you can
run all your tests.
By default, the web app will be available at http://localhost, on ports 80 and 443.
See the `docker-compose.yml` file for more details.
## Continuous Integration
App Project is cross-platform and can be used in public and private projects.
You can use it on [GitLab](https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/),
on [GitHub](https://docs.github.com/en/actions/automating-builds-and-tests/about-continuous-integration),
on your computer, anywhere you want.
The App Project is already pre-configured to run in a GitLab CI environment.
See the `.gitlab-ci.yml` file for more details.
Just upload your project to GitLab and it will run
[pipelines](https://docs.gitlab.com/ee/ci/pipelines/#view-pipelines).
On GitHub, it will run [workflows](https://docs.github.com/en/actions) to test
your code every Push or Pull Request.
Check the `.github` folder to see more.
## And now?
Go build an API or a website, an awesome app! ⚡
See you.
---
If you have a little time...
Visit the Aplus Framework website: [aplus-framework.com](https://aplus-framework.com)
Follow Aplus on:
- [GitHub](https://github.com/aplus-framework)
- [X](https://x.com/AplusFramework)
- [Facebook](https://www.facebook.com/AplusFramework)
- [YouTube](https://www.youtube.com/@AplusFramework)
Stay tuned for our updates.
Share your experiences about meet us!
**Remember**:
> Coding is Art.
>
> Coding is Engineering.
>
> Good developer loves to code.
>
> **Code with Love!**
---
The Aplus Framework Team
================================================
FILE: SECURITY.md
================================================
# Security Policy
The **latest** and **LTS** versions of this library receive security fixes.
If you find any vulnerability send an email to `aplusframework@gmail.com`.
================================================
FILE: app/Commands/Index.php
================================================
'The app is running! Yep!',
'title' => 'Aplus Framework',
];
================================================
FILE: app/Languages/es/home.php
================================================
'¡La app se está ejecutando! ¡Sí!',
'title' => 'Aplus Framework',
];
================================================
FILE: app/Languages/pt-br/home.php
================================================
'O app está rodando! Sim!',
'title' => 'Aplus Framework',
];
================================================
FILE: app/Models/.gitkeep
================================================
================================================
FILE: app/Views/_layouts/default.php
================================================
= isset($title) ? esc($title) : 'Aplus Framework' ?>
= $view->renderBlock('contents') ?>
================================================
FILE: app/Views/errors/404.php
================================================
extends('default');
$view->block('contents');
?>