Git Product home page Git Product logo

joomla-entity's Introduction

Entity system for Joomla!

Because developing Joomla extensions should be fun and easy.

Quickstart

Let's use a fast example. This is how you actually can load an article by its id in Joomla:

Load an article

Where $article is a stdClass object. You can access its properties but it's really a dummy thing. An end point.

With an Article entity you can do:

Load an article

Here $article is an Article entity. An object that exposes its logic and resources to the developer.

Some awesome things that you can do with that article entity:

// Use article as entity
echo $article->get('title');

// Use params transparently
if ($article->param('show_title', '1') === '1')
{
	echo $article->get('title');
}

// Check if article is featured
if ($article->isFeatured())
{
	// Do something
}

// Check if article has an intro image
if ($article->hasIntroImage())
{
	$image = $article->getIntroImage();
	echo '<img src="' . JUri::root(true) . '/' . $image['url'] . '" />';
}

// Check article state
if ($article->isPublished())
{
	echo 'Article published!';
}

// Retrieve article category
echo $article->category()->get('title');

// You can modify article properties
$article->set('title', 'My modified title');

// And save it
try	
{
	$article->save();
}
catch (\RuntimeException $e)
{
	echo 'There was an error saving article: ' . $e->getMessage();
}

See the full documentation for other examples.

Installation

Go to the releases section and follow the How to install / upgrade instructions in the latest release.

Documentation

Documentation is published in https://phproberto.github.io/joomla-entity/.

Requirements

  • PHP 7.1+
  • Joomla! CMS v3.9+

Copyright & License

This library is licensed under GNU LESSER GENERAL PUBLIC LICENSE.

Copyright (C) 2017-2019 Roberto Segura López - All rights reserved.

joomla-entity's People

Contributors

brianteeman avatar jatitoam avatar phproberto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.