getting_started
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
getting_started [2019/09/28 14:28] – created sahl | getting_started [2024/02/14 14:16] (current) – sahl | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Background ===== | ===== Background ===== | ||
- | Platform is a PHP framework | + | Platform is a fullstack |
+ | |||
+ | The framework is intended to make development of PHP applications very fast, and making it easy to implement new ideas. At the same time the framework is intended to be very easy to understand | ||
+ | |||
+ | ===== Software requirements ===== | ||
+ | |||
+ | Platform runs on PHP and requires | ||
===== Architecture of platform apps ===== | ===== Architecture of platform apps ===== | ||
- | Platform application | + | Platform |
+ | |||
+ | Programming something like Facebook would be considered | ||
===== Installing platform ===== | ===== Installing platform ===== | ||
- | Copy the code into your website folder and edit config.php to fit your needs. | + | Copy the code into your website folder and go to the website root. An interactive procedure will guide you through configuring the platform. You will need to have your database credentials ready, and decide where Platform is going to store files, and make these locations writeable by the web user. |
- | <code php> | + | Platform4PHP will write a configuration file one level up from the web site root, so it need to be able to do so. |
- | $platform_configuration = array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | + | ||
- | ' | + | |
- | ' | + | If you are configuring for instances, then the local database user should have full permissions, including creating and dropping databases, as it is needed when creating instances. |
- | ' | + | |
- | + | ||
- | ' | + | |
- | ); | + | |
- | </ | + | |
- | The database | + | Store folders should be writable for the web user, but doesn' |
- | Folders should be writable by the web server user and the cron job user. | + | Lastly you need to setup a PHP cron job, if you want to use the Platform |
- | + | ||
- | When finished save the file and go to https:// | + | |
- | + | ||
- | Now you are ready to start coding! | + | |
===== Demo example ===== | ===== Demo example ===== | ||
Line 43: | Line 35: | ||
A new instance have now been created with a test user. Observe that a new database is created. You can log out of this instance and into it again. You can also create further instances if you want to, or destroy the instances you have already created. | A new instance have now been created with a test user. Observe that a new database is created. You can log out of this instance and into it again. You can also create further instances if you want to, or destroy the instances you have already created. | ||
- | ==== Source code walkthrough | + | ===== Where to go next? ===== |
- | + | ||
- | We start in ''/ | + | |
- | <code php [enable_line_numbers=" | + | |
- | <?php | + | |
- | include $_SERVER[' | + | |
- | + | ||
- | pagestart(' | + | |
- | + | ||
- | $new_instance_form | + | |
- | + | ||
- | $new_instance_form-> | + | |
- | // Check if instance if taken | + | |
- | if (\Platform\Instance:: | + | |
- | $new_instance_form-> | + | |
- | return false; | + | |
- | } | + | |
- | return true; | + | |
- | }); | + | |
- | + | ||
- | if ($new_instance_form-> | + | |
- | $values | + | |
- | $instance | + | |
- | if ($instance instanceof \Platform\Instance) { | + | |
- | // Instance was created. Login and continue. | + | |
- | $instance-> | + | |
- | $loginresult | + | |
- | if ($loginresult) { | + | |
- | header(' | + | |
- | exit; | + | |
- | } | + | |
- | $new_instance_form-> | + | |
- | } else { | + | |
- | $new_instance_form-> | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | echo '< | + | |
- | echo '< | + | |
- | echo '</ | + | |
- | + | ||
- | echo '< | + | |
- | $new_instance_form-> | + | |
- | echo '</ | + | |
- | + | ||
- | echo '< | + | |
- | echo ' | + | |
- | echo '</ | + | |
- | + | ||
- | pageend(); | + | |
- | </ | + | |
- | + | ||
- | Line 4 outputs the start of the page including the starting html-tag, the head-section and the starting body tag. See [[Design class]] for more info. | + | |
- | + | ||
- | In line 6 we create a form to create the instance, which is easily accomplished using the special form file format. In line 8 we add an additional validation function to the form, which check that the name of the instance isn't already used, and triggers an error on the appropriate form field, if this is the case. | + | |
- | In line 17 we check for a form submission and validates | + | You can start by navigating to the [[tutorial]] which explains in detail how the demo is constructed from scratch going through |
- | See more in the [[Form class]] and the [[Instance | + | Otherwise go to the [[classes]] hierarchy to browse the different platform components or start building your own application. The first step in building your own application is to create a subclass of the [[Instance |
- | The rest of the page is just layout, with the form being outputted in line 39. | + | Otherwise it is just to explore the other classes in Platform and start coding away. The aim of Platform |
getting_started.1569680908.txt.gz · Last modified: 2019/09/28 14:28 by sahl