User interface with php

User interface with php

Запись: Velonski/mytetra-database/master/base/1539362888zirwmtj8at/text.html на raw.githubusercontent.com

ATK UI — Collection of interractive Web App UI components

Do you use a CSS framework?

ATK UI began 2 years ago as a project to wrap CSS framework into PHP objects. We started with Fields, Forms, Tables and Menus. Then we added callbacks to enable interactivity. Then came layouts. Next we integrated data mapping and persistence frameworks; virtual pages and JavaScript action abstraction; dynamic popups, real-time console and progress-bar. We have even added high-level components such as wizard and dynamic tabs and make them extremely simple to use!

ATK UI helps you create modern Web UI without writing HTML/CSS/JS. Bundled with over 30 interactive UI components that seamlessly integrate with your SQL, NoSQL or API backend, ATK UI brings consistent and easy-to-use interface into your custom projects or popular web apps

Quick-Links: Documentation. Namespaces. Demo-site. ATK Data. Forum. Chat. Commercial support. Udemy Course.

ATK UI is simple and really saves time

Some of you «live to code». For everyone else — ATK UI is a great fit. Easy to learn and saves loads of time.

Watch this free Udemy course if you are a beginner: https://www.udemy.com/web-apps-with-php-and-atk

Dowlnoad from www.agiletoolkit.org or Install ATK UI with composer require atk4/ui

Then you only need to create a single PHP file:

$app = new \atk4\ui\App(); // That’s your UI application

$form = new \atk4\ui\Form(); // Yeah, that’s a form!

$form->addField(’email’); // adds field

return $form->success(‘Subscribed ‘.$form->model[’email’].’ to newsletter.’);

// everything renders automatically

Open PHP in the browser and observe a fully working and good looking form:

ATK UI relies on https://fomantic-ui.com CSS framework to render the form beautifully. It also implements submission call-back in a very straightforward way. The demo also demonstrates use of JavaScript action, which can make objects interract with each-other (e.g. Form submit reloads Table).

Database Integration with ATK Data

To get most of ATK UI, use ATK Data to describe your business models such as «User» or «Purchase». When you define models, you can start using some more advanced components:

CRUD is a fully-interractive component that supports pagination, reloading, conditions, data formatting, sorting, quick-search, ordering, custom actions and modals, but at the same time is very easy to use:

$app = new \atk4\ui\App(‘hello world’);

$app->add(new CRUD())->setModel(new User($app->db));

ATK Data allows you to set up relations between models:

$this->hasMany(‘Purchases’, new Purchase());

Conventional CRUD works only with a single model, but with add-on you can take advantage this relationship information: https://github.com/atk4/mastercrud

$master_crud = $app->add(new MasterCRUD());

ATK UI uses default settings from Formantic-UI but they can be styled. You can create custom applicaiton layouts, page layouts and widgets. Here is a screenshot of an application developed using ATK UI:

Callbacks. Callbacks everywhere!

One of the fundamental features of ATK is Callback — ability to dynamically generate a route then have JS part of the component invoke it. Thanks to this approach, code can be fluid, simple and readable:

$tab->addTab(‘Intro’)->add([‘Message’, ‘Other tabs are loaded dynamically!’]);

$tab->addTab(‘Users’, function($p) use($app)

// This tab is loaded dynamically, but also contains dynamic component

$tab->addTab(‘Settings’, function($p) use($app)

// Second tab contains an AJAX form that stores itself back to DB.

Another component implementation using a very friendly PHP syntax:

You get most benefit when you use various ATK UI Components together. Try the following demo: http://ui.agiletoolkit.org/demos/wizard.php. The demo implements:

Multi-step wizard with ability to navigate forward and backward

Data memorization in the session

Table with column formatter, Messages

With ATK it takes about 50 lines of PHP code only to build it all.

ATK UI is part of Agile Toolkit

Comparing to some other CRUD / Admin builders, the UI components rely on a very powerful ATK Data framework, which can be also used separately and can be used to power your RestAPI end-points.

See how ATK Data compares with other ORM engines and you’ll understand why we choose it over some of the alternatives: http://socialcompare.com/en/comparison/php-data-access-libraries-orm-activerecord-persistence

To help you understand the real power behind ATK Data integration, look at this aggregation / reporting addon: https://github.com/atk4/report. Compared to any open-source report suites that you can find for PHP, this is the only implementation that relies on «Model Domain Logic» rather then SQL queries for expressing your report criteria and can be used for ANY component in ATK UI as well as addons, such as Charts. There are no performance implications, because all the expressions and aggregations are executed inside your database through the means of SQL.

ATK is commercially supported

The MIT license gives you absolute freedom, but no warranty. To compliment that, the team who created ATK as well as some early contributors joined together to run a consultancy company. We help you deliver your projects by:

Fixing bugs in ATK or add-ons — free of charge

Building add-ons that extend functionality — moderate hourly rate fee.

Integration tasks or building parts of your project — quotation based.

Our motto is to «always give back to open-source community and be fair to our clients». We are hiring PHP and JavaScript developers who are passionate about ATK and are active within our community.

If you need a help, go to our website and click on «Contact» link.

Getting Started: Build your admin

It’s really easy to put together a complex Admin system. Add this code to a new PHP file (tweak it with your database details, table and fields):

class User extends \atk4\data\Model

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Extensionless PHP Graphic User Interface library

gabrielrcouto/php-gui

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

* Fix to custom JSON decoder

Git stats

Files

Failed to load latest commit information.

README.md

php-gui

Extensionless PHP Graphic User Interface library

PHP can be more than a «Web Language», it’s a fast language, with a cross platform interpreter and a good CLI. GUI is a natural step for completing this ecosystem.

For many years, GUI projects are being developed for PHP, like PHP-GTK, PHP-QT, wxPHP and so many others, but none of them became popular.

This project aims to solve the most common problems of existing «GUI Projects»:

  • The need for installing an extension
  • Cross platform
  • No external dependencies
  • Easy to install (composer require php-gui) / Easy to use ($button = new Button)

The following PHP versions are supported:

Download the library using composer:

$ composer require gabrielrcouto/php-gui

Latest version (development)

$ composer require gabrielrcouto/php-gui:dev-master

Now, you can build a GUI application. Let’s do a Hello World!

 require 'vendor/autoload.php'; use Gui\Application; use Gui\Components\Button; $application = new Application(); $application->on('start', function() use ($application) < $button = (new Button()) ->setLeft(40) ->setTop(100) ->setWidth(200) ->setValue('Look, I\'m a button!'); $button->on('click', function() use ($button) < $button->setValue('Look, I\'m a clicked button!'); >); >); $application->run();

Simple? 👏 You don’t need to compile anything, just download the library via composer and use it! 😄

But, if you want to see some examples, just follow the instructions below.

# clone the repository git clone https://github.com/gabrielrcouto/php-gui.git cd php-gui # install dependencies composer install # run examples php examples/01-basic/example.php php examples/02-animation/example.php php examples/03-window/example.php php examples/04-multiple-windows/example.php php examples/05-canvas/example.php php examples/06-ping/example.php php examples/07-php-internals/example.php php examples/08-alert/example.php php examples/09-3d-perspective/example.php

To create a GUI without the need for an extension, PHP executes a binary with proc_open and communicates with it using Stdin/Stdout Pipes—it’s a fast and cross platform solution.

PHP Stdin/Stdout Pipes Lazarus Application GUI

The binary is created using Lazarus (Free Pascal). After much research, I found a large advantage by using Lazarus over other desktop languages (like C#, Java. ):

LCL graph, showing that LCL will use an interface for building the GUI according to the operation system

It doesn’t have any dependencies (except for Linux, which needs GTK), has a good component library, is compiled, open source and has a nice slogan (Write Once, Compile Anywhere).

The communication (IPC) between PHP and Lazarus is performed using a protocol based on JSON RPC. You can view the specification here.

To be an easy to use library, this project will use HTML friendly names for the components, as PHP developers are more familiar with it.

  • On Lazarus, the property «caption» is for the text of a button. On php-gui, the property name is «value».
  • On Lazarus, «Edit» is the component for text input, on php-gui, it’s «InputText».

For compiling the lazarus binary:

If you are generating the Linux binary, you can use Docker:

lazarus/linux-docker.sh cd lazarus/ lazbuild phpgui.lpr

First install the dependencies, and after you can run:

The «Issues» page from this repository is being used for TO-DO management, just search for the «to-do» tag.

Источник

Читайте также:  Simple java main example
Оцените статью