Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I want to learn OOP PHP, and I think I need to know all predefined classes of PHP. However I cannot find any website that has list of them. On php.net i only find functions and there are examples of doing it oop or procedural way. Does anybody know where should I find those classes? Big thanks for replies
There is a function for that: http://php.net/manual/en/function.get-declared-classes.php
Note that this doesn't output interfaces, but there is also a function for that: http://php.net/manual/en/function.get-declared-interfaces.php
Remember that this will give you all classes of extensions that are currently installed, as only these are available. It will not include classes or interfaces that are available in extensions that are not installed.
However, learning OOP is independent from knowing all existing classes. If you want to do something concrete, like accessing the file system, I'd think it appropriate to then read about file system classes and their OOP interface, but it would be useless to read about the Memcache class if you don't want to use Memcache. Most of the time in OOP you create your own classes and program the business logic of the application - you will encounter built-in classes very rarely, because usually you'd add a wrapping or isolating layer around their results pretty soon, and then pass these (your own) objects around.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 10 months ago.
Improve this question
I am a PHP beginner and learning Laravel (currently Laravel 9). I have seen some tutorials, and I am experimenting with them. I noticed that there are many classes defined in the framework itself. I want to know whether there is a guide explaining the implementation and usage of these classes.
For example, there are Illuminate\Http\Response and Illuminate\Support\Facades\Response classes. Both seem to have the same usage, but I could be wrong.
There are some other questions, too, like a global namespace response() which creates a new response instance, so why would I use Illuminate\Http\Response or Illuminate\Support\Facades\Response to create a new instance?
Are there any guides where it specifies when, where, and why we would use those classes?
Are there any rules for such situations?
I also couldn't find a complete guide for handling audio files and creating an audio player before finding the solution here in ronline's answer.
You can find more information about the Laravel classes in the API.
In the case of Illuminate\Http\Response and Illuminate\Support\Facades\Response, you can find them here:
https://laravel.com/api/master/Illuminate/Http/Response.html
https://laravel.com/api/master/Illuminate/Support/Facades/Response.html
If you want more info on the difference between Illuminate\Http\Response and Illuminate\Support\Facades\Response, the facade doesn't have the header method. This is answered here (in the comments):
Laravel 5.2- Call to undefined method Illuminate\Support\Facades\Response::header()
This website seems to give more information on response objects:
https://laravel-guide.readthedocs.io/en/latest/responses/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am creating a php mvc framework for learning purposes.
I have a really simple PDO wrapper but I feel it is still too much trouble for the user to write all the sql queries themselves. So I want to implement something like ORM like almost all php frameworks have. However, I am not a big fan of ORM and was wondering if there were any (good) alternatives to ORM. If not, then can someone provide me with a simple good ORM example?
An alternative can be the one described by Tony Marston on Using PHP Objects to access your Database Tables (Part 1) (Part 2). With that he construct a DML Class and finally a Data Dictionary.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am looking for suggestions, references, articles that can help me understand as how to create a website builder. My users will choose a template and then edit in the editor similar to WIX.com I am interested to offer them a platform with similar features.
If there is any article or resource available that can give me an idea as what are the pros and cons of the application.
Thanks again for your help.
This question doesn't exactly belong here but
I've built a website builder and here's the gist;
It's going to take a long time
You're describing an application that's going to take a long time to make.
A website builder is not a small application it's going to have a lot of features in order to stand out and compete with the website builders that are already in place.
You're going to have to either have a team or be good at coding yourself
This application will need to follow an architecture like MVC to be able to properly perform maintenance on your application and to keep extending it's functionallity.
You're either going to need to be good at PHP, SQL, JS and JQuery and have a lot of time on your hands or have a team to get this done with the right skill sets.
No place to walk you through
The complexity of this application would also be very high and there is no document or video that will walk you through building the entire application simply because of it's complexity.
You're going to have to come up with how to build this application yourself.
If you're going to want to be doing this make sure you're prepared and have the resources to do so, this is not just a simple little project.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Is there any PHP refactoring tool that would transform a huge noodle code to a proper function based one?
No, you can't do that automatized. Static analysis may reformat your code, eliminate bad practices or inform you about security vulnerabilities, but it can't turn your code into nice and clean OOP.
2019+ answer
Nowadays you can use a tool called Rector (I'm author of).
It uses nikic/php-parser, static analysis and node based rules. That means you can e.g. rename every case of function strlen to Nette\Utils\Strings::length().
Or basically anything you want to. Many rules are supported from in the core code (see Rector on Github), e.g. upgrade from PHP 5.2 throughout to 7.4.
But it can be configured to do what you want. It will take some thinking to determine how to detect what should be extracted and what not. If you can put the transformation into words as a human, it's possible to put that into PHP code so it will do everywhere in your code for you.
Zend Studio (for Eclipse) has support for refactoring code - it allows you to select a piece of code and extract functions/methods. For example:
It also allows for renaming of variables to further clean up your code. While this is not a fully automated solution, it will significantly help you clean up the mess. Hope this helps.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm in the process of generating API docs for an in-house web app that's undergoing some expansion. It's a DHTML project, with a mix of both some OO and mostly procedural PHP, and purely procedural Javascript. At the moment, it's pretty much all documented for the appropriate doc generators (phpdocumentor and jsdoc), but the two were never "connected". I could go through and add manual link statements to the doc blocks, but managing all those links (like "../jsdoc/filename.html#function) is a real pain.
Any suggestions for documentation generators that handle both PHP and JavaScript, and allow something like #see functionName between languages?
If worst comes to worst, I can hack together a script to rewrite LINK URLs from some magic syntax (i.e. js: and php:), but I'd really rather have something that will allow a unified tree view of everything.
Thanks,
Jason
After looking at a number of options, I wrote a PHP script that parses JS files, pulls out the doc blocks and function definitions, and then writes it to a file that phpdoc can process. It just needs one line added to phpDocumentor.ini so it will parse .js files.
The blog post talking about it is at:
http://blog.jasonantman.com/2010/08/documentation-generation-for-web-apps-php-and-javascript/
And the script is at:
http://svn.jasonantman.com/misc-scripts/