All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Getting started with PHP/Web development
Hey everyone
I was recently asked to help a friend making a website (basically a PHP time management/schedule system). My problem is that while i have sufficient experience with desktop development (Java, C, etc) but, apart from modding some things, no experience at all with PHP/HTML/CSS/JS.
So i've been looking for some frameworks/best practices/etc to get started with this project. It appears that it would be the easiest thing to use Bootstrap for all the design stuff and some PHP framework for the coding (although i don't even know what PHP frameworks exactly do). A quick Google search gave me Yii+Bootstrap which looks fine on the first glance. Can anyone comment on it or suggest better alternatives? Also are there some good ressources for "getting started with PHP" (not in the sense of learning for loops but in the sense of differences in comparison to desktop development)? And what are good IDEs?
Thanks for any help in advance
Comments
I use NetBeans IDE for PHP Development, that's about all I can help you with, havent got any resources for you to learn, but maybe a flick through some of the CodeCademy stuff that's more intermediate / advanced may assist you.
For IDE, anything that displays with different colors to highlight syntax. But I just default to Eclipse, it has a PHP distribution.
For framework, I suggest Code Igniter as the learning curve is not that steep. For database framework, maybe use RedBean. It's so easy. If also okay with you, you can also consider not using a web framework and just use plain PHP with directories and includes and whatnot. With RedBean of course, that will save you time.
I like bootstrap. I also like jquery easy ui www.jeasyui.com
@gsrdgrdghd: Yii+Bootstrap looks good. It's nice to have the raw HTML extracted from your PHP code. For the icing on the cake, you could also use CodeIgniter as @jcaleb mentioned for your routing etc and some nice libraries.
For instance, then
example.com/myclass/myfunc/hello-world
would access:But I agree with @eastonch, & there are probably loads of open-source time management/schedule system applications already you could just modify depending on what they require; uniqueness etc.
http://www.php.net/manual/en/language.oop5.basic.php
http://php.net/manual/en/book.pdo.php (+ prepared statements)
http://www.smarty.net/
http://stackoverflow.com/questions/tagged/php (use it like google)
http://net.tutsplus.com/category/tutorials/php/ (lot's of content on popular frameworks)
and I personally use netbeans. upload on save is the bee's knees.
Don't forget http://www.phptherightway.com/ has some nice "guidelines"
With the footnote that, despite the deceptive naming, it's not the "right way", but the way the creator of the site prefers.
EDIT: Also, stay far away from bcrypt. It has a practically undocumented character limit and silently discards everything that exceeds it. Do. Not. Use. It. There are plenty of safe alternatives.
A 72 character limit.
If someone needs a 100 character password to feel "safe", then tough luck on any of my sites
More around 50 or so, for PHP.
Never thought of people using passphrases instead of passwords?
This is a crude example but: http://codepad.viper-7.com/DQqY7g
You're still able to use passphrases, but only the first 72 characters will be used in the creation of the hash.
I'm talking about the native implementation of bcrypt via crypt().
Which makes it far less secure. After the first 72 (or other amount) of characters it doesn't matter what you enter.
I see no valid reason to use bcrypt and introduce an unnecessary character limit, when there are various alternatives that are equally secure.
@joepie91, What would you advise as a bcrypt alternative? Is it only the password length that is the issue? I like password generators; I would prefer to use generated
128
passwords than keys, as keys can be hassle sometimes. It's also annoying how any should have any character limit at all.another tip, don't design your code on how you do desktop app. you have to think differently. otherwise, your problems will pile up
SHA256/SHA512 (with a few thousand rounds), Scrypt (GPU-hostile), ...
Ya, that's why I said "guidelines" but that probably wasn't the best word to use :P
It does have a few good best practices though for new users. That's why I suggested it.
Thanks everyone for the suggestions. I think i'll stick to Yii+Bootstrap (since it seems rather simple and clean)
In what way do i need to design my code differently? So far all the frameworks i've found seem to use the MVC pattern which is rather similar to desktop development.
it's common for desktop developers to code in stateful manner. thats one way.
Ah ok. I've noticed the same difference when coding an Android app (and didn't really like it)
There are many subtle differences. But if you are following examples you are okay. In some companies I've worked with (e.g. background is Delphi, or Oracle Forms), they tend to bend how web usually works and they write their own framework code such that they code the same way they code in Delphi or Oracle Forms.
That would actually be a nice thing to do, someone needs to publish such a framework
After having tried using Yii and some other frameworks i'm really overwhelmed with the complexity.
Isn't there some really basic framework that just lets me create a .php file for each page and provides some simple things like layout (header, footer, menubar) and database connectivity?
That would be PHP itself
require(), PDO, and the rest of the PHP standard library are all you need for that. You don't need a framework to work with PHP.
Take a look at laravel ...
I'm aware of that option but i guess it will just require even more work.
I feel like there needs to be a better/easier solution to create a basic website than mixing 2 programming languages, 3 markup languages, 1 query langauge and thousands of incompatible 3rd party tools, all shattered and lumped together over hundreds of files.
Thank i'll take a look at it.
I'm not sure what you're refering to...
You have one server-side language (PHP) without any fancy stuff tacked onto it. You include() a header and a footer on each page. You use SQL, which is (and should be!) a separate layer to retrieve stuff from the database.
You have one client-side markup language (HTML), along with CSS and Javascript where necessary.
How is what I suggested unnecessarily complex, where do the 'thousands of incompatible 3rd party tools' come from (I'm not even sure what you mean with it), and how are the above components not present when working with a framework?
2 programming languages: PHP, JS 3 Markup languages: HTML, CSS, (LESS) one query language: SQL
Sorry for the confusion, i wasn't refering to your suggestion. I meant all the premade frameworks with unnecessary much complexity. But i'll try the approach you suggested now
For easy to learned framework, you should try code igniter. Its user guide is awesome and easy to follow..
welcome to web development.
My friends like CakePHP, I personally haven't tried it though but you can have a look at that also. I've heard about code igniter but never used it either. Personally, I recently discovered that dreamweaver has a little file manager that can use SFTP. Ever since, I've been coding from one app and creating my own little bootstraps. I've noticed extremely good performance doing this since the code is much much less (neither bloated) and might help keep your LEBs out of major load problems.