Ouzo Framework - PHP MVC ORM

Overview

Ouzo Framework

Ouzo is a PHP MVC framework with built-in ORM and util libraries. PHP 8.0 or later is required.

Build Status Documentation Status Coverage Status Latest Stable Version Total Downloads License Average time to resolve an issue

Join the chat at https://gitter.im/letsdrink/ouzo

We believe in clean code and simplicity. We value unit testing and beautiful design.

Want to know more?

For ideas, questions, discussions write to [email protected].

Current release

See the release notes and latest documentation.

Contributing to Ouzo

  • Don't hesitate to ask questions on mailing list or submit issues on github.
  • If you know the answer to questions/problems that others have then go ahead and reply.
  • Found something unclear in docs or app messages? Let us know and help us improve Ouzo.
  • If you miss a feature - check out issues, maybe it is already addressed. If not, drop us an example of what you need (issues or mailing list).
  • Want to help? Browse the issues and grab something to work on!
  • How to contribute? Create a fork and start a branch. Let us know when you are done, we will discuss it and merge your pull request.

General rules

  • We encourage you to use PhpStorm IDE for Ouzo development.
  • Write a test. Or tests. The more the better.
  • Make sure to run a full test suite before you send us a PR.
  • Don't forget to update the docs!
  • And the changelog as well.

Support for PHP versions older than 8.0

Ouzo has dropped support for PHP versions older than 8.0 since Ouzo 2.x. If you want to use Ouzo with PHP 5.6 or 7.x, please try Ouzo 1.x branch.

Comments
  • Get rid of

    Get rid of "dump-autoload" in development

    The fact that I have to use dump-autoload each time I create a new class is really miserable. I'd prefer not to use it in debug mode and tests. It should be required only in production mode.

    bug 
    opened by bbankowski 10
  • Change docs from md to rst

    Change docs from md to rst

    I propose to change docs from markdown to the restructuredtext. RST has more options to formatting and looks better. What do you think?

    Here is docs for rst format: http://sphinx-doc.org/rest.html

    I saw better docs written using the rst syntax.

    enhancement 
    opened by piotrooo 6
  • Array with object access

    Array with object access

    I think we should have feature:

    $array = [
        ['id' => 123, 'name' => 'value1'],
        ['id' => 456, 'name' => 'value2']
    ];
    $ids = Arrays::map($array, Functions::extract()->id);
    

    where $ids returns:

    Array
    (
        [0] => 123
        [1] => 456
    )
    
    feature 
    opened by piotrooo 5
  • Tests on Windows fail

    Tests on Windows fail

    Because of usage of /tmp in tests: file_put_contents(/tmp/SampleConfigFile.php): failed to open stream: No such file or directory

    We should be using Path::joinWithTemp() to fix it.

    bug 
    opened by bbankowski 5
  • Priority to match route

    Priority to match route

    Case:

    Route definition:

    Route::get('/users/:id', 'users#show');
    Route::get('/users/get_contacts', 'users#get_contacts');
    

    Now I call request /users/get_contacts, it should match to second route, but now is matched to the first. Routes with parameters should have low priority than exactly route.

    bug 
    opened by piotrooo 4
  • Added doc lines

    Added doc lines

    Maybe good think will be add documentation links at the beginning of each Ouzo file.

    Something like this:

    /*
    * This file is part of Ouzo.
    *
    * (c) Ouzo developers <[email protected]>
    *
    * For the full copyright and license information, please view the LICENSE
    * file that was distributed with this source code.
    */
    
    cosmetic 
    opened by piotrooo 4
  • Model: default attribute value

    Model: default attribute value

    class User extends Model {
        public function __construct($attributes = array()) {
            parent::__construct(array(
                'attributes' => $attributes,
                'fields' =>  array( 'description',  'created_at'),
                'defaults' =>  array( 'created_at' => Clock::nowAsString())
            ));
        }
    

    or maybe even:

    class User extends Model {
        public function __construct($attributes = array()) {
            parent::__construct(array(
                'attributes' => $attributes,
                'fields' =>  array(
                      'description', 
                      'created_at' => Clock::nowAsString())
            ));
        }
    
    feature 
    opened by woru 4
  • Updates in ConfigTest.php

    Updates in ConfigTest.php

    • Tests would fail on windows because of /tmp usage, but it turns out it's not even necessary.

      Tests would save SampleConfigFile class in /tmp/SampleConfigFile.php, because there once was CustomConfig that could load files, so to test that /tmp/SampleConfigFile.php was created for testing. Later, it was removed in favour of SampleConfig, but instead of removing /tmp/SampleConfigFile.php, it was left as it was, and then immediately include_once. Obviously this is unnecessary since the file isn't tested, only the class that's passed to registerConfig(). Without the file, the test doesn't need to operate on filesystem, so tests pass on windows.

    • Tests were reliant on the order and the fact that multiple tests are run. If you run any test that uses registerConfig() but not reload() (so shouldReadMultipleSampleConfigs(), shouldReadSampleConfig(), shouldReturnConfigValue()), they would fail if you run them separately.

      Further more, because the config remembers the state between tests (static field), the tests are sometimes false-positive, so even if you remove the code from given/when it would pass, because other tests registered the config. They would be caught, if the tested values were different, but SampleConfig always returned the same value for each test, so each assertion passed.

      To fix it, I made new SampleConfig() into new SampleConfig(['foo' => 'bar']), so each test recieves unique key=>value pair, and isn't prone to false positives from other configs.

    Feel free to squash the commits while merging the PR.

    opened by Danon 3
  • Scaffolding for new routes

    Scaffolding for new routes

    This:

    console ouzo:routes --add users#assign
    

    Could add method assign for UsersController and also add route

    Route::get('/users/assign', 'users#assign');
    

    And also regenerate uri helper. For generating other methods (post, resource etc) a flag could be used.

    opened by Danon 3
  • Chainable ArrayAssert

    Chainable ArrayAssert

    We could achieve something like this

    /**
     * @test
     */
    public function shouldFetchCompanies()
    {
        // when
        $companies = $cache->getCompanies();
    
        // then
        Assert::thatArray($companies)
            ->onProperty('name')->containsExactly('Woru Inc. Sp. z o.o.')->hasSize(1)
            ->onProperty('id')->containsExactly('ajdi')->hasSize(1);
            ->onProperty('owner')->containsOnly('me');
    }
    
    • (+) Multiple onProperty in one assert
    • (+) Still can chain conditions
    • (-) You can not make recursive onProperty (While getting object of object, you cannot get property of the second object again)
    • (+) recursive onProperty is useless anyway, because we always want to check arrays, strings and integers (primitive values)

    All we have to do is:

    • ArrayAssert must accept second optional field (lets call it $originalData). Constructor is private and access is via static factory, so this optional parameter is never revealed.
    private function __construct(array $actual, array $originalData = [])
    {
        // ...
        $this->_originalData = $originalData ?: $actual;
    }
    
    • onProperty must pass its $originalData param to the new instance it creates
    
    public function onMethod($method)
    {
        return new ArrayAssert(// ..
        }), $this->_originalData);
    }
    
    • Every method with a condition (so, constains, containsSequence, isEqualTo, excludes, etc.) must replace
    return $this;
    

    to

    return $this->then();
    

    and method then() is implemented like this

    return new ArrayAssert($this->originalData);
    
    feature 
    opened by Danon 3
  • Extended criteria API in query builder: add OR

    Extended criteria API in query builder: add OR

    'or' is a keyword. We can use '_or' or 'any'

    Proposal:

    User::where(Query::any(array(
      Query::where(array('name' => 'bob')),
      Query::where(array('surname' => 'smith'))
    )))->fetchAll();
    

    any means 'or'

    enhancement 
    opened by woru 3
  • `FluentArray.skip()` and `limit()` leak `array_slice()` implementation detail

    `FluentArray.skip()` and `limit()` leak `array_slice()` implementation detail

    If you run this

    $array = [
        'Key' => 'One',
        10    => 'Two',
        20    => 'Three'
    ];
    //when
    $result = FluentArray::from($array)->limit(2)->toArray();
    

    The resulting array is ['Key' => 'One', 0 => 'Two'], which doesn't make any sense. Same for skip(). (array_slice() reindexes integer keys, but keeps string keys -.-)

    What should be done now is:

    • limit() and skip() should preserve keys (add true flag to array_slice()) - this probably makes more sense
    • limit() and skip() should reindex the array (use array_values())
    opened by Danon 0
  • `Strings` broken for multibytes

    `Strings` broken for multibytes

    Commit https://github.com/letsdrink/ouzo/commit/017bbe6754528784bfed76adff50c8b5210e2d9a probably broke multi-byte safety, because this test now fails (test not in ouzo, I just wrote it)

    /**
     * @test
     */
    public function shouldNotStartWithMalformedUnicode()
    {
        // given
        $subject = '€';
        $infix = \chr(226);
    
        // when
        $startsWith = Strings::startsWith($subject, $infix); // returns true
    
        // then
        $this->assertFalse($startsWith);
    }
    

    str_starts_with() is not mb-safe. Previous implementation would make this test pass. Maybe revert?

    opened by Danon 0
  • Shouldn't `Json::encode()` in ouzo use `JSON_UNESCAPED_SLASHES`?

    Shouldn't `Json::encode()` in ouzo use `JSON_UNESCAPED_SLASHES`?

    echo Json::encode('5/6');
    

    Result

    "5\/6"
    

    Why is / escaped?

    If you use JSON_UNESCAPED_SLASHES from https://www.php.net/manual/en/json.constants.php, it doesn't quote slash anymore.

    PS: From PHP documentation I found, that PHP json_encode() quotes /, because when you arbitrarily paste it into <script></script> (so maybe 0.01% of use-cases), then / is disallowed and malforms HTML, but that's a really weird reason, since it should be encoded with htmlentities().

    opened by Danon 0
  • Is `Strings` vulnerable to regexp injection by design?

    Is `Strings` vulnerable to regexp injection by design?

    This usage emits a warning and reveals underlying implementation:

    Strings::sprintAssoc("This is %{what}! %{what}? This is %{+}!", [
        '+' => 'madness',
    ]);
    
    preg_replace(): Compilation failed: nothing to repeat at offset 3
    

    And also, you can't use unquoted slash /.

    Strings::replaceNth($uri, 'http://www', '', 2);
    
    preg_match_all(): Unknown modifier 'w'
    

    Is this by design?

    question 
    opened by Danon 0
  • Rename `Functions::extract()` to `Functions::argument()`

    Rename `Functions::extract()` to `Functions::argument()`

    $cities = Arrays::map($users, Functions::extract()->getAddress('home')->city);
    
    $cities = Arrays::map($users, Functions::argument()->getAddress('home')->city);
    
    question 
    opened by woru 0
Releases(1.8.0)
  • 1.8.0(Mar 26, 2021)

    Support for PHP 5.6 is dropped. Minimal PHP version required is 7.4.

    Enhancements:

    • [Utilities] Added Arrays.getDuplicates(), Arrays.getDuplicatesAssoc().
    • [Utilities] Added FluentArray.getDuplicates(), FluentArray.getDuplicatesAssoc().
    • [Core] Added database migration tools (migrate:run and migrate:generate).
    Source code(tar.gz)
    Source code(zip)
  • 1.7.0(Oct 13, 2019)

    Enhancements:

    • [ORM] Model implements Serializable and JsonSerializable interfaces (issue #203).
    • [ORM] Changed Model::deleteEach to use iterator instead of fetching all elements at once (issue #254).
    • [ORM] Fixed fetchIterator to properly use cursor underneath.
    • [ORM] Implemented upsert functionality (Model::createOrUpdate).
    • [ORM] Fixed using primary key value when given as an attribute, instead of using sequence.
    • [DI] Added constructor injection for arguments with types defined (issue #265).
    • [DI] Implemented injection of private fields for parent class.
    • [DI] Implemented injection through factory class.
    • [DI] Implemented named parameters for constructor injection.
    • [DI] Implemented lazy loading for singleton classes.
    • [DI] Added module loader.
    • [Utilities] Added equalsIgnoreCase to Functions and FluentFunctions (issue #263).
    • [Utilities] Added ToStringBuilder in the apache-commons style.

    Bug fixes:

    • [Utilities] Fixed Clock to support DST changes when adding hours, minutes or seconds.
    • [Utilities] Fixed Arrays::getNestedValue when keys lead to non-existing element with scalar parent.
    • [MVC] Added clearstatcache before downloading files.
    • [Tests] Fixed handling of null return type for mock objects.
    Source code(tar.gz)
    Source code(zip)
  • 1.6.1(Mar 29, 2017)

    Enhancements:

    • [Core] Added Validatable::errors(), so multiple errors can be added at once.
    • [Core] Added Whoops library (issue #243).
    • [Core] Removed separate 404 view (you have to check http code in exception.phtml)
    • [ORM] Added Db::query()->fetchIterator() method (issue #241).
    • [ORM] Added support for EXISTS subqueries.
    • [ORM] Added ModelQueryBuilder::fetchIterator() (issue #242).
    • [ORM] Added Restrictions::isIn().
    • [Tests] Added Assert::that() (issue #245).
    • [Tests] Added Assert::thatBool().
    • [Tests] Added Assert::thatArray()->keys().
    • [Utilities] Added Functions::notNull().
    • [Utilities] Added Arrays::isAssociative() and Arrays::concat().
    • [Utilities] Added UnbatchingIterator.
    • [Utilities] Added FluentArray::flip().
    • [Utilities] Json::decode() and Json::encode() will from now on, throw exceptions on invalid input.
    • [Utilities] Added Json::safeDecode() and Json::safeEncode().
    • [Utilities] You can now read URL parameters as controllers' method arguments (issue #244).
    • [Utilities] Clock.useTimezone() accepts both string or DateTimeZone.
    • [Utilities] Added Strings::containsIgnoreCase.
    • [Debug] After renderPartial(), you can now find PARTIAL and END PARTIAL HTML comments along with partial name.

    Bug fixes:

    • [Core] Fixed searching routes with a @ character.
    • [ORM] Fixed query parenthesis (issue #239).
    • [ORM] Insert returns id of the last inserted element as int.
    • [ORM] Fixed EmptyQueryExecutor::fetchIterator() method.
    • [Tests] More verbose message when null is passed to Mock::verify() (issue #236).
    • [Utilities] Fixed extracting ArraysAssert.
    • [Utilities] Fixed Arrays::toArray() for empty string, false and zero.
    • [Utilities] Fixed Strings::remove() when given falsy argument (like '0').
    • [Utilities] Removed $encoding parameter from Strings::uppercaseFirst().
    • [Utilities] Clock will not modify parameter DateTime.
    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Jun 15, 2016)

    Enhancements:

    [Utilities] Implemented Arrays::contains method (issue #103).
    [Utilities] Added Clock::isAfterOrEqualTo and Clock::isBeforeOrEqualTo.
    [Utilities] Added multi-byte safe Strings::uppercaseFirst.
    [Utilities] Added pseudo localization support.
    [MVC] Layout has now access to view variables.
    [ORM] Added exception handling for invalid query.
    [Utilities] Added Functions::endsWith method.
    [Tests] Added verifier - Mock::receivedTimes (issue #153).
    [Utilities] Added method Strings::removeAccent.
    [Tests] Handle parameters in ControllerTestCase::get.
    [ORM] Added BatchInserter.
    [Utilities] Added Strings::substringAfter method.
    [Utilities] Added FluentArray::sort method.
    [Utilities] Added FluentArray::filterByAllowedKeys method.
    [DI] Added dependency injection support (IoC container).
    [Tests] Added chain to Mock::when (issue #209).
    [ORM] Added Restrictions:regex method (issue #213).
    [Core] ControllerFactory use Injector (issue #223).
    [Utilities] Added FluentArray::groupBy method.
    [DI] Injector can inject itself.
    [DI] Injector config can be modified after injector initialization.
    [Utilities] Added support for ArrayAssert::extract method (issue #231).
    [Utilities] Added methods Functions::inArray and Functions::notInArray.
    [Utilities] Refactored Booleans.
    [Utilities] Added Arrays::shuffle.
    [Core] Added Controller::getRequestHeaders.
    [Core] Added options to PDO.
    

    Bug fixes:

    [Utilities] Fixed ArrayAssert, so that it does some type checking based on Arrays::contains behavior (issue #192).
    [MVC] Fixed major performance issue with routes validation.
    [ORM] Fixed inserting records with no values (issue #216).
    [Tests] Support for controller tests without configured database.
    [Core] Fixed json decode to make it compatible with PHP7 (issue #191).
    [ORM] Fixed method Model::nullifyIfEmpty.
    [Core] Fixed ForbiddenException - takes errors.
    [Tools] Fixed generating models (issue #214).
    [Core] Bootstrap::addConfig loads everything multiple times on consecutive executions (issue #218).
    [Tools] Fixed generating @property (issue #168).
    [ORM] Handle in batch inserter tables without primary key.
    [Core] Fixed exception when config was not added to Bootstrap.
    [Utilities] Fixed SkippingIterator so that map function is not applied on skipped elements.
    [ORM] Fixed BatchInsert with fetched relations (issue #230).
    [Utilities] Fixed cache for nulls.
    [Core] Fixed render 404 on RouterException.
    [Utilities] Fixed null handling for Optional.
    [Utilities] Fixed String::contains for multi-byte.
    [Utilities] Added limit (10) to number of requests being kept in Stats (issue #217).
    [Utilities] Fixed comparing in Functions::notEqual and Functions::equal with type check.
    [Utilities] Fixed reset JSON on error.
    
    Source code(tar.gz)
    Source code(zip)
  • 1.5.1(Jul 28, 2015)

    Enhancements:

    [ORM] Added support for subqueries in Query.
    [Utilities] Added Functions::random.
    [Utilities] Added Iterators (issue #189). 
    

    Bug fixes:

    [MVC] Request stats are now logged only when debug is enabled. 
    [MVC] Added more verbose logging when controller was not found (issue #187).
    [Utilities] Fixed Arrays::removeNestedKeys.
    
    Source code(tar.gz)
    Source code(zip)
  • 1.5.0(Jun 15, 2015)

    Enhancements:

    [Utilities] Extended Comparator::compareBy to support multiple expressions (issue #169).
    [ORM] Added possibility of using multiple Restrictions in Any::of for the same key.
    [Utilities] Added Suppliers::memoizeWithExpiration that returns supplier which caches the result of function.
    [Core] Minimal log level can be assigned to a particular class/name in logger configuration.
    [Core] Added Validatable::validateEmpty method.
    [ORM] Extended Restrictions::between with modes: inclusive, exclusive etc. (issue #176).
    [ORM] When using DbTransactionTestCase transactions are disabled (issue #178).
    [Core] Added support for CSRF token in forms.
    [Tools] Added method that lists all generated URI helper methods (GeneratedUriHelper::allGeneratedUriNames).
    [Utilities] Implemented Optional class (issue #72).
    [ORM] Added support for SELECT ... FOR UPDATE - with ModelQueryBuilder's lockForUpdate method.
    [ORM] Added support for DELETE USING.
    [MVC] Session is being closed when downloading or streaming file.
    [MVC] Added support for UTF-8 characters in routes.
    

    Bug fixes:

    [Localization] Fixed I18n::loadLabels not to load translation file if it was already loaded (issue #173).
    
    Source code(tar.gz)
    Source code(zip)
  • 1.4.1(Feb 11, 2015)

    Enhancements:

    [ORM] New restrictions: isNull and isNotNull.
    [ORM] Added EmptyWhereClause class.
    [Utilities] Objects::getValue supports arrays now. It means that all functions depending on it (e.g. Functions::extract) supports arrays as well.
    [ORM] Added switch for model generator to utilize shorthand array syntax (issue #160).
    [ORM] Added switch for model generator to display output instead of saving file (issue #158).
    [ORM] Added support for sorted hasMany relations (issue #171).
    [Tests] Added ArrayAssert::isEqualTo method.
    

    Bug fixes:

    [Utilities] Added Arrays::mapEntries (issue #156).
    [ORM] Fixed null parameters in where clause (issue #161).
    [ORM] Fixed model generator namespace and folder name (issue #149).
    [Utilities] Added Arrays::uniqueBy (issue #159).
    [Tests] Changed ArrayAssert::hasSize, so that it shows original array when assertion fails (issue #163).
    [ORM] Fixed insert when sequence is empty (issue #174).
    
    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Dec 30, 2014)

    Enhancements:

    • Extracted Ouzo Goodies, which can be used from now on as a separate project.
    • Versioned documentation available at ouzo.readthedocs.org.
    • [ORM] Added Any::of to produce OR operator (issue #141).
    • [Utilities] Added Strings::substringBefore.
    • [Tests] Added CatchException::get.

    Bug fixes:

    • [ORM] Fixed transaction rollback on exception (issue #115).
    • [Tests] Better messages when assertThat::onMethod fails (issue #128).
    Source code(tar.gz)
    Source code(zip)
  • 1.3(Dec 16, 2014)

    Enhancements:

    • [Core] Added radio button to form builder.
    • [Tests] Added ArrayAssert::hasEqualKeysRecursively method.
    • [Utilities] Added Arrays::flattenKeysRecursively method.
    • [Utilities] Added Files::getFilesRecursivelyWithSpecifiedExtension method.
    • [Core] Added after init callback.
    • [Localization] Added I18n::labels method to get all labels or specified label.
    • [Tests] Changed CatchException asserts to fluent methods.
    • [Utilities] Objects::getValue can access private fields.
    • [Tests] ArrayAssert::onProperty can access private fields (issue #113).
    • [Core] Added support for pluralization in translations (issue #111).
    • [ORM] Added Model::selectDistinct method (issue #91).
    • [ORM] Added support for model default values (issue #66).
    • [Core] Displayed routes in table (issue #93).
    • [ORM] Added TransactionalProxy.
    • [Core] Migrate to PHPUnit 4.3.3 and adding assert adapter (issue #119).
    • [Utilities] Added Strings::sprintAssoc method.
    • [Extensions] Added HTTP Auth Basic extension.
    • [Utilities] Added Strings::contains method.
    • [Utilities] Added Functions::constant, Functions::notEquals, Functions::equals and Functions::throwException methods.
    • [Mock] Added thenAnswer method.
    • [Utilities] Added FluentFunctions class.
    • [Core] Added RequestHeaders::all method.
    • [Core] Added possibility to configure multiple loggers configurations.
    • [ORM] Optimisation - do not select columns of models that will not be stored in fields.
    • [Utilities] Added Validate class (issue #117).
    • [Tests] Implement streamMediaFile in MockDownloadHandler.
    • [Utilities] Added Files::copyContent method.
    • [Core] Added possibility to group routes (#80).
    • [ORM] Extended criteria API in query builder - Restriction (issue #68).
    • [Utilities] Added Arrays::count method.
    • [Mock] Added argument matcher.
    • [Utilities] Added a default value to the StrSubstitutor.
    • [Utilities] Added Functions::isInstanceOf.
    • [Utilities] Added Date::formatTimestamp.
    • [Utilities] Added Comparators.
    • [Utilities] Enhanced the Clock class.
    • [Core] Paths to model, controller and widget are configurable from config (issue #147).
    • [Utilities] Added RequestHeaders::ip.
    • [Core] Controller::renderAjaxView use current action as default (issue #104).

    Bug fixes:

    • [ORM] Added meaningful exception when Model::findById is invoked, but no primary key is defined (issue #121).
    • [Utilities] Fixed generating model fields in correct order (issue #102).
    • [Utilities] Fixed generating empty primary key when not in table (issue #98).
    • [Utilities] Fixed Functions::notBlank (issue #106).
    • [Core] Fixed throwing orginal message when throw UserException (issue #109).
    • [Utilities] Fixed Arrays::flattenKeysRecursively (issue #110).
    • [Core] Fixed parsing of Json inputs (#114).
    • [ORM] Fixed zero as primary key.
    • [Utilities] Fixed extractor for 'empty' values like 0 or empty array.
    • [Core] Fixed HTTP request parameters priority.
    • [Core] Fixed parse PUT HTTP request.
    • [Core] Fixed uri ContentType letter case insensitive.
    • [ORM] Fixed not fetching relation joined through hasMany (which resulted in an error).
    • [Core] Fixed generating form name in ModelFormBuilder.
    • [Mock] Fixed DynamicProxy uses uniqid (issue #127).
    • [Core] Fixed invalid formatting of GeneratedUriHelper (issue #131).
    • [Utilities] Fixed Boris (issue #136).
    • [Core] Updated path resolver to return correct view depend on request headers.
    • [ORM] Accept single param in Model::findBySql (issue #145).
    • [ORM] Alias in update queries (issue #142).
    Source code(tar.gz)
    Source code(zip)
  • 1.2(Aug 28, 2014)

    Enhancements:

    • [ORM] Added conditions to relations.
    • [Core] Added StdOutput logger.
    • [Core] Added Error::getByCode.
    • [Utilities] Added Functions::extractExpression.
    • [Utilities] Added FluentArray::uniqueBy.
    • [ORM] Ignore order, limit and offset for count queries.
    • [ORM] Group by support in model.
    • [Core] Improved handling of alerts.
    • [Tests] Added StringAssert::isEmpty and StringAssert::isNotEmpty methods.
    • [Tests] Added CatchException::hasMessage method.
    • [Utilities] Added method Files::size.
    • [Utilities] Added Functions::surroundWith.
    • [Utilities] Added Joiner::mapValues.
    • [Utilities] Added method Files::exists.
    • [Tools] Improved model generator API.
    • [Utilities] Added a new extractor in ArrayAssert.
    • [Core] Added methods that extract protocol and host in Uri class (Uri::getProtocol and Uri::getHost).
    • [Core] Replaced custom Ouzo loader with composer loader.

    Bug fixes:

    • [Tests] Fixed StreamStub write method.
    • [Core] Fixed notices url in controller.
    • [Mock] Fixed handling of params by reference (issue #89).
    • [ORM] Set joined models on results only once for duplicated joins with different aliases.
    • [Core] Trim url in Controller::redirect method.
    • [ORM] Fixed relations fetching. Relations are fetched only once.
    • [Core] Fixed interface in ConsoleCommand.
    • [Core] Fixed logging of original error messages in error handler.
    • [Utilities] Throw exception if empty extractor is called (issue #97).
    • [ORM] Fixed Model::__isset so that it works for lazy relations.
    • [Utilities] Arrays::hasNestedKey: added a flag to treat null as a value (added const TREAT_NULL_AS_VALUE).
    • [Core] Fixed json parsing in Uri class.
    • [ORM] Fixed #100.
    Source code(tar.gz)
    Source code(zip)
  • 1.1(May 20, 2014)

    Enhancements:

    • Added callback methods to Model: beforeSave and afterSave.
    • Added method Json::encode.
    • Added DeleteDirectory util.
    • Added method Strings::trimToNull.
    • Stats class collects HTTP request data.
    • Added RequestContext class to keep information on controller.
    • Added DynamicReturnTypePlugin config (PhpStorm support).
    • [Mock] Stub multiple calls to a method.
    • Added method Path::normalize.
    • Added PDO attributes to config.
    • Added interactive mode.
    • Controller can set up headers to send (Controller::header).
    • Upgraded to PHPUnit 4.0.
    • Added methods FluentArray::filterNotBlank and Arrays::filterNotBlank (issue #71).
    • Added equivalent of PDO::ATTR_EMULATE_PREPARES to Ouzo (issue #76).
    • Added method Functions::extract.
    • Added method Date::formatTime.
    • Added support for nested controllers (Issue #80).
    • Added new routes methods - Route::put and Route::delete.
    • Extended ControllerTestCase with possibility to test response headers.
    • New way of handling HTTP Auth Basic - using AuthBasicController.
    • Added method Strings::appendPrefix.
    • Added class ResponseMapper which translates HTTP code to HTTP header.
    • Added OuzoException which is a wrapper for generic PHP excepion.
    • Added class Error with exception code and message inside.
    • Added API exceptions to handle appropriate HTTP error codes (InternalException, NotFoundException, UnauthorizedException, ValidationException).
    • Added methods StringAssert::isNull and StringAssert::isNotNull.
    • Added method RequestHeaders::accept for parsing Accept HTTP header.
    • Class OuzoException accepts additional headers.
    • When authorization is invalid UnauthorizedException is thrown.
    • [ModelGenerator] Added default table information.
    • [ModelGenerator] Setting namespace in generated model class.
    • [Core] Migrated Shell to Symfony Console.
    • [Core] Removed Shell (now using Symfony Console).
    • [Core] Support url with and without prefix in notices.
    • [Utilities] Renamed Arrays::hasNestedValue to Arrays::hasNestedKey and Arrays::removeNestedValue to Arrays::removeNestedKey (issue #54).

    Bug fixes:

    • [Routes] Fixed invalid method name in generated uri helper for camelcase methods in controllers (issuse #69).
    • [Mock] Fixed DynamicProxy so that it works with interfaces (issuse #70).
    • [Mock] Fixed method matcher.
    • [Routes] Fixed parsing default routing (issue #62).
    • [Mock] Fixed mock verification.
    • [Routes] Fixed regexp in matching routes (issue #75).
    • [DB] Fixed error in PDO executor.
    • [DB] Fixed sqlite error codes.
    • [ORM] Fixed nested 'with' and one-to-many relations (issue #82).
    • [Routes] Fixed nested resources in uri generator.
    • [Core] Support for redirect url.
    • [Tests] Parsing url setting in method ControllerTestCase::get (issue #79).
    • [Utilities] Fixed Arrays::getNestedValue when passing more keys than are in the array.
    • [Tests] Fixed deleting sample config file in ConfigTest.
    • [ORM] Throw exception if invalid sequence in model (issue #85).
    • [Core] Fixed revert of null properties in config.
    Source code(tar.gz)
    Source code(zip)
Owner
Ouzo
Ouzo Framework and plugins for PHP
Ouzo
The Enobrev\ORM library is a small framework of classes meant to be used for simply mapping a mysql database to PHP classes, and for creating simply SQL statements using those classes.

The Enobrev\ORM library is a small framework of classes meant to be used for simply mapping a mysql database to PHP classes, and for creating simply SQL statements using those classes.

Mark Armendariz 0 Jan 7, 2022
Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP

Propel2 Propel2 is an open-source Object-Relational Mapping (ORM) for PHP. Requirements Propel uses the following Symfony Components: Config Console F

Propel 1.2k Dec 27, 2022
PHP DataMapper, ORM

Cycle ORM Cycle is PHP DataMapper, ORM and Data Modelling engine designed to safely work in classic and daemonized PHP applications (like RoadRunner).

Cycle ORM 1.1k Jan 8, 2023
Simple Enum cast for Eloquent ORM using myclabs/php-enum.

Enum cast for Eloquent Simple Enum cast for Eloquent ORM using myclabs/php-enum. Requirements PHP 7.3 or higher Laravel 8.0 or higher Installation You

Orkhan Ahmadov 5 Apr 21, 2022
Doctrine Object Relational Mapper (ORM)

3.0.x 2.9.x 2.8.x Doctrine 2 is an object-relational mapper (ORM) for PHP 7.1+ that provides transparent persistence for PHP objects. It sits on top o

Doctrine 9.5k Jan 2, 2023
Baum is an implementation of the Nested Set pattern for Laravel's Eloquent ORM.

Baum Baum is an implementation of the Nested Set pattern for Laravel 5's Eloquent ORM. For Laravel 4.2.x compatibility, check the 1.0.x branch branch

Estanislau Trepat 2.2k Jan 3, 2023
ORM layer that creates models, config and database on the fly

RedBeanPHP 5 RedBeanPHP is an easy to use ORM tool for PHP. Automatically creates tables and columns as you go No configuration, just fire and forget

Gabor de Mooij 2.2k Jan 9, 2023
A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen

Laravel Doctrine ORM A drop-in Doctrine ORM 2 implementation for Laravel 5+ $scientist = new Scientist( 'Albert', 'Einstein' ); $scientist->a

Laravel Doctrine 777 Dec 17, 2022
Extensions for the Eloquent ORM

Sofa/Eloquence Easy and flexible extensions for the Eloquent ORM. Currently available extensions: Searchable query - crazy-simple fulltext search thro

Jarek Tkaczyk 1.1k Dec 20, 2022
Builds Cycle ORM schemas from OpenAPI 3 component schemas

Phanua OpenAPI 3 + Jane + Cycle ORM = ?? Phanua builds Cycle ORM schemas from OpenAPI 3 component schemas. Released under the MIT License. WARNING: Th

Matthew Turland 5 Dec 26, 2022
Extra RedBean ORM

RedBeanPHP 5 RedBeanPHP is an easy to use ORM tool for PHP. Automatically creates tables and columns as you go No configuration, just fire and forget

GingTeam Development 5 Nov 23, 2022
Articulate - An alternative ORM for Laravel, making use of the data mapper pattern

Articulate Laravel: 8.* PHP: 8.* License: MIT Author: Ollie Read Author Homepage: https://ollie.codes Articulate is an alternative ORM for Laravel bas

Ollie Codes 4 Jan 4, 2022
MongoDB ORM that includes support for references,embed and multilevel inheritance.

Introduction Features Requirements Installation Setup Database Basic Usage - CRUD Relationship - Reference Relationship - Embed Collection Inheritance

Michael Gan 202 Nov 17, 2022
Low code , Zero Configuration ORM that creates models, config, database and tables on the fly.

?? ARCA ORM ?? Low code , Zero Configuration ORM that creates models, config, database and tables on the fly. ?? ???? Made in India ???? Complete docu

Scrawler Labs 28 Dec 18, 2022
Orm is a simple database abstraction layer that supports postgresql.

Orm What is it Orm is a simple database abstraction layer that supports postgresql. Welcome to join us or star us for encouragement. Requires php 8.1

null 2 Sep 28, 2022
The lightweight PHP database framework to accelerate development

The lightweight PHP database framework to accelerate development Features Lightweight - Less than 100 KB, portable with only one file Easy - Extremely

Angel Lai 4.6k Dec 28, 2022
Griffin is a Graph-Oriented Migration Framework for PHP

Griffin is a generic migration framework that uses graph theory to provision anything. It plans execution based on migration dependencies and runs them in the correct order.

Griffin 14 Feb 7, 2022
a php client for distributed transaction framework dtm. 分布式事务管理器dtm的php客户端

a client for distributed transaction manager dtm dtmcli 是分布式事务管理器dtm的客户端sdk dtm分布式事务管理服务 DTM是一款跨语言的开源分布式事务管理器,优雅的解决了幂等、空补偿、悬挂等分布式事务难题。提供了简单易用、高性能、易水平扩

null 29 Jan 7, 2023
A complete, simple and powerful database framework written in PHP

BaseSQL BaseSQL is a complete database framework written in PHP. It was built to accelerate projects development by handle database connections and qu

Willian Pinheiro 2 Sep 21, 2021