A simple, secure, and scalable PHP application framework

Overview

Opulence

Build Status Latest Stable Version Latest Unstable Version License

Introduction

Opulence is a PHP web application framework that simplifies the difficult parts of creating and maintaining a secure, scalable website. With Opulence, things like database management, caching, ORM, page templates, and routing are a cinch. It was written with customization, performance, and best-practices in mind. Thanks to test-driven development (TDD), the framework is reliable and thoroughly tested. Opulence is split into components, which can be installed separately or bundled together.

Installation

Opulence can be installed using Composer:

composer create-project opulence/project --prefer-dist

Documentation

For complete documentation, visit the official website.

Requirements

  • PHP 7.3
  • OpenSSL
  • mbstring

License

This software is licensed under the MIT license. Please read the LICENSE for more information.

Author

Opulence was written by David Young.

Comments
  • Restrict Choices for Encrypter's Ciphers

    Restrict Choices for Encrypter's Ciphers

    Currently, the encrypter class lets you select broken ciphers. I propose restricting the ciphers you're allowed to select. If a broken cipher is selected, an \InvalidArgumentException should be thrown.

    enhancement 
    opened by davidbyoung 18
  • Publish a coding standards document

    Publish a coding standards document

    Hi, great project.

    Your code is very consistent but doesn't always match Symfony / PSR style. For example: Use of double quotes instead of single quotes even though there is no "$var" inside the string, single line PHPDoc comments for class properties, ...

    It would be nice if you could publish a document explaining what style you expect contributors to adhere to.

    Bonus points if I could import it into PHPStorm.

    Thanks.

    screenshot from 2017-01-10 11-06-58

    enhancement 
    opened by connerbw 16
  • [FEATURE] QueryBuilder::whereIn

    [FEATURE] QueryBuilder::whereIn

    It would be nice if the query builder supported a whereIn function, along with orWhereIn. This is something I miss quite often also in other frameworks.

    Example usage:

    use Opulence\QueryBuilders\PostgreSql\QueryBuilder;
    
    $query = (new QueryBuilder)->select("id", "name", "email")
        ->from("users")
        ->whereIn("id", [1, 2, 3])
        ->orWhereIn("email", ["[email protected]", "[email protected]"]);
    echo $query->getSql();
    

    This would output:

    SELECT id, name, email FROM users WHERE id IN (?, ?, ?) OR email IN (?, ?)
    

    I wouldn't mind giving implementing this a shot, the only question is whether this should default to using named or unnamed parameters. Perhaps it could default to unnamed, with an optional parameter to use named parameters? I'd like to hear what you think.

    opened by MaartenStaa 15
  • phpDocumentor problem

    phpDocumentor problem

    Nice framework but unfortunately phpDocumentor does not read the IO\Stream folder probably because Opulence uses reserved names or because it does not support: void as return value.

    Unfortunately I do not know the reason.

    Could you resolve please?

    Thank you

    wontfix 
    opened by adrix71 12
  • Migration errors

    Migration errors

    While developing AbterPHP, I ran the migrations hundreds of times and it kept bugging me to debug query errors, because currently the migration commands wouldn't even tell me that there was an error. With these changes I would be able to create a migration class like this:

    <?php
    
    declare(strict_types=1);
    
    namespace AbterPhp\Framework\Databases\Migrations;
    
    use Opulence\Databases\Migrations\Migration;
    
    class BaseMigration extends Migration
    {
        // ...
    
        /**
         * @inheritdoc
         */
        public function down(): bool
        {
            $sql       = 'SELECT 1';
            $statement = $this->connection->prepare($sql);
            if (!$statement->execute()) {
                $this->errors = $statement->errorInfo();
    
                return false;
            }
    
            return true;
        }
    
        /**
         * @inheritdoc
         */
        public function up(): bool
        {
            $sql       = 'SELECT 1';
            $statement = $this->connection->prepare($sql);
            if (!$statement->execute()) {
                $this->errors = $statement->errorInfo();
    
                return false;
            }
    
            return true;
        }
    }
    

    Obviously this change would warrant at least a minor version bump, if not a major one.

    opened by peteraba 11
  • Environment setup is extremely confusing.

    Environment setup is extremely confusing.

    The entire environment setup is quite confusing to use. While it is possible to integrate it with other tools such as phinx, it isn't easy nor convenient.

    Dotenv is a fantastic package maintained by Vance that provides a seamless environment configuration experience. Simple to use and share between tooling.

    Could a move to using Dotenv be considered? Taking advantage of it will provide the best experience to developers.

    opened by Garbee 8
  • Initial efforts for PHP8 support

    Initial efforts for PHP8 support

    There are two main topics to be solved:

    1. Some PDO adapters are not compatible with \PDO classes they extend (Connection, Statement)
    2. Reflection usage. Especially relying on the now deprecated ReflectionParameter::getClass. Additionally it seems like something has changed in regards to tokenization / autoloader, because the ReflectionClass constructor fails for the parsed migrations in FileMigrationFinder
    opened by peteraba 7
  • unambiguous migration ordering during running migrations:down

    unambiguous migration ordering during running migrations:down

    Issue description

    The executedmigrations table will contain the datetime of the execution in the daterun column and this would be then used for finding the latest executed migration if you ran ./apex migrations:down. The problem is, if you ran previous migrations at once before, this will not provide a sufficient way to select the latest migration run. Instead it will pick a random one executed in the exact second of the truly last executed one.

    Example

    Code

    namespace AbterPhp\Users\Databases\Migrations;
    // ...
    class Init extends Migration
    {
        // ...
        public static function getCreationDate(): DateTime
        {
            return DateTime::createFromFormat(DateTime::ATOM, '2019-02-28T21:00:00+00:00');
        }
        // ...
    }
    
    namespace AbterPhp\Pages\Databases\Migrations;
    // ...
    class Init extends Migration
    {
        // ...
        public static function getCreationDate(): DateTime
        {
            return DateTime::createFromFormat(DateTime::ATOM, '2019-02-28T21:01:00+00:00');
        }
        // ...
    }
    
    namespace AbterPhp\Files\Databases\Migrations;
    // ...
    class Init extends Migration
    {
        // ...
        public static function getCreationDate(): DateTime
        {
            return DateTime::createFromFormat(DateTime::ATOM, '2019-02-28T22:00:00+00:00');
        }
        // ...
    }
    
    namespace AbterPhp\Contact\Databases\Migrations;
    // ...
    class Init extends Migration
    {
        // ...
        public static function getCreationDate(): DateTime
        {
            return DateTime::createFromFormat(DateTime::ATOM, '2019-02-28T23:00:00+00:00');
        }
        // ...
    }
    

    Database

    | migration | daterun | --------------| -----------| AbterPhp\Users\Databases\Migrations\Init | 2019-03-04 12:03:43 | AbterPhp\Contact\Databases\Migrations\Init | 2019-03-04 12:03:44 | AbterPhp\Files\Databases\Migrations\Init | 2019-03-04 12:03:44 | AbterPhp\Pages\Databases\Migrations\Init | 2019-03-04 12:03:44 |

    It may any of the last 3 for migrate:down.

    Incomplete list of potential fixes

    1. Replace daterun column with a time format which will contain some high resolution time. (Backwards compatible, but requires a schema upgrade)
    2. Store the getCreationDate in a column and use that as a second sorting parameter when selecting the "last run" migration.
    3. Retrieve all migrations run at the same time as the "last" one and select the migration with the latest getCreationDate returned. (Backwards compatible and no schema upgrade necessary, but he query will be somewhat harder to understand, and could lead to problems if someone changes the getCreatedAt value of a migration.)
    4. ~~Sleep 1 second before executing consecutive schema upgrades.~~ :smile:

    Note: Using microseconds as high resolution time is probably enough in most cases although it might just make it harder to reproduce the issue. Giving an option to use hrtime instead could have benefits, but only doable in PHP at the moment afaik. (https://pecl.php.net/package/hrtime, http://php.net/manual/en/function.hrtime.php) Without hrtime precision it might make sense to combine more solutions too.

    bug 
    opened by peteraba 7
  • Update default path to localhost_router.php

    Update default path to localhost_router.php

    I just installed the skeleton, but was receiving this error:

    /project$ php apex app:runlocally
    Running at http://localhost:80
    [Fri Dec 22 11:05:39 2017] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
    [Fri Dec 22 11:05:39 2017] PHP Fatal error:  Unknown: Failed opening required '/project/public/localhost_router.php' (include_path='.:/usr/share/php') in Unknown on line 0
    

    This patch I am submitting fixed the issue for me.

    bug 
    opened by adamaltman 7
  • ensure ENV_NAME and Environment::name are never out of sync

    ensure ENV_NAME and Environment::name are never out of sync

    The Opulence starter project sets ENV_NAME as an environment variable, and that environment variable is then used to set the Environmnet::name. If the ENV_NAME variable is changed, or the Environment::name member is changed, the two values would no longer have been equal.

    opened by itised 7
  • Suggestion: Add option to clear console cache for apex

    Suggestion: Add option to clear console cache for apex

    One thing I learned is that there's a cache file for console that almost instantly gets cached in tmp/framework/console called cachedBootstrapperRegistry.json and say if you remove a bootstrap class it'll throw a fatal error making apex compeltely unusable because it's looking for a class that doesn't exist anymore.

    My suggestion is to be able to call: php apex --hard-cache-clear which does one thing and that's to clear the cache directly and nothing else that way you won't have to manually do it to get apex working again.

    I'm still learning Opulence, so maybe I'll try creating a PR if I figure it out tonight.

    enhancement 
    opened by exts 6
Releases(v1.2.2)
  • v1.2.2(Feb 20, 2022)

    This release fixed a bug when the PHP binary path contains a space. It also converted all CI to use GitHub Actions instead of TravisCI and splitsh locally.

    Source code(tar.gz)
    Source code(zip)
Owner
Opulence
Opulence PHP framework
Opulence
Opulence is a PHP web application framework that simplifies the difficult parts of creating and maintaining a secure, scalable website.

Opulence Introduction Opulence is a PHP web application framework that simplifies the difficult parts of creating and maintaining a secure, scalable w

Opulence 733 Sep 8, 2022
Simple, fast and secure PHP Framework with easy integration.

simple-php-framework Simple, fast and secure PHP Framework with easy integration.

winact 2 Nov 23, 2021
Yii 2: The Fast, Secure and Professional PHP Framework

Yii 2 is a modern framework designed to be a solid foundation for your PHP application. It is fast, secure and efficient and works right out of the bo

Yii Software 14k Dec 31, 2022
Flare is a PHP full-stack web framework that is light, fast, flexible, and secure.

Flare framework is a PHP full-stack web framework that is simple ,powerful , fast , flexible, and secure with long-term support.

Flare framework 3 Oct 24, 2022
CodeIgniter - a PHP full-stack web framework that is light, fast, flexible and secure

CodeIgniter 4 Development What is CodeIgniter? CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure. More informatio

CodeIgniter 4 web framework 4.5k Jan 4, 2023
Laravel 8 Project Restrict User Access From IP Addresses. prevent other ip address that want to access over secure api or urls.

block-ip-address-laravel Laravel 8 Project Restrict User Access From IP Addresses. prevent other ip address that want to access over secure api or url

Hasmukh Dharajiya 2 Mar 24, 2022
Framework X is a simple and fast micro framework based on PHP

Framework X is a simple and fast micro framework based on PHP. I've created a simple CRUD application to understand how it works. I used twig and I created a custom middleware to handle PUT, DELETE methods.

Mahmut Bayri 6 Oct 14, 2022
Sunhill Framework is a simple, fast, and powerful PHP App Development Framework

Sunhill Framework is a simple, fast, and powerful PHP App Development Framework that enables you to develop more modern applications by using MVC (Model - View - Controller) pattern.

Mehmet Selcuk Batal 3 Dec 29, 2022
Simple PHP framework that helps you quickly understand and write simple APIs.

Lightweight-PHP-Framework-For-APIs. Simple PHP framework that helps you quickly understand and write simple APIs. Installation Use the package manager

Youssef Hajjari 24 Jul 22, 2022
Simple PHP framework that helps you quickly understand and write simple APIs.

Lightweight PHP Framework For Web and APIs PHP framework that helps you write quickly simple but powerful web apps and APIs Installation Use the packa

Youssef Hajjari 24 Jul 22, 2022
Framework X – the simple and fast micro framework for building reactive web applications that run anywhere.

Framework X Framework X – the simple and fast micro framework for building reactive web applications that run anywhere. Quickstart Documentation Tests

Christian Lück 620 Jan 7, 2023
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

null 14 Aug 14, 2022
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

Rizky Alamsyah 14 Aug 14, 2022
Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily.

Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily. Leaf introduces a cleaner and much simpler structure to the PHP language while maintaining it's flexibility. With a simple structure and a shallow learning curve, it's an excellent way to rapidly build powerful and high performant web apps and APIs.

Leaf Framework 706 Jan 3, 2023
Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components

Spiral HTTP Application Skeleton Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components.

Spiral Scout 152 Dec 18, 2022
High-Performance Long-Living PHP Framework for modern enterprise application development

Documentation · Discord · Telegram · Twitter Spiral Framework is a High-Performance Long-Living Full-Stack framework and group of over sixty PSR-compa

Spiral Scout 1.4k Jan 1, 2023
PHPLucidFrame (a.k.a LucidFrame) is an application development framework for PHP developers

PHPLucidFrame (a.k.a LucidFrame) is an application development framework for PHP developers. It provides logical structure and several helper utilities for web application development. It uses a functional architecture to simplify complex application development. It is especially designed for PHP, MySQL and Apache. It is simple, fast, lightweight and easy to install.

PHPLucidFrame 19 Apr 25, 2022
Rori-PHP is custom non production web application framework inspired by Laravel syntax

Rori-PHP is custom non production web application framework inspired by Laravel syntax. A web framework provides a structure and starting point for your application allowing you to focus on creating something amazing.

UnknownRori 5 Jul 28, 2022
Newsprint is a simple web application that will fetch the front page of a newspaper and display it on an eink display

Newsprint is a simple web application that will fetch the front page of a newspaper and display it on an eink display. The specific resolutions and sizes have been setup to work with a 32" eInk place & play display from Visionect but can be modified for other screen resolutions.

Greg Raiz 199 Dec 20, 2022