What is APEC meeting PHP what is pear?

Source: Internet
Author: User
Tags benchmark pear php books what php
PHP enthusiasts will love pear, our goal is to introduce pear to PHP developers, I personally think that the application of the Code library development approach has gradually become a trend, in addition to PHP, JSP, like Perl, C + + has a dedicated library for its developers to reference.
In addition to the introduction of pear,php program developers can greatly reduce the work and time to write code, but also in a very simple way to get a lot of powerful Dynamic Web page function, I will enumerate a lot of examples, so that we will be able to look after the applause, and deeply fascinated by the pear. In addition, the code is easy to maintain, high security is also pear another 2 attractive advantages, Paer library as a module, can easily swap and update, without affecting the other code.
Are we starting with the most basic concepts, including the meaning of the pear term? Where do I get the pear kit? How do I use the pear kit, etc.?
From the 2nd chapter, we first introduce the origin, history and characteristics of pear, so that everyone has a basic understanding of pear.
The 3rd chapter we will introduce the installation and management of the Pear Library Suite, this chapter is very important, before using pear, it is necessary to learn these basic kung fu, although a bit complex, but learn to benefit from the infinite, so that your PHP program development efficiency doubled, function with step-up.
The 4th chapter is a simple example of how to reference the Pear Library to develop PHP programs, let us understand the general use of pear, but also for the use of the library to establish a basic operational process.
In the fifth chapter, we will introduce a few examples of simple and powerful library suites that allow you to quickly build something you could not imagine and cool on a dynamic Web page to improve your programming skills immediately. For example:
Let the webpage provide the function of the weather forecast, increase the added value of the webpage.
A simple way to set up a Web page cache on the server to speed up the opening of the Web page.
Search for a host on a dynamic Web page that has services that provide those port numbers.
Query a domain name (DNS) on a Dynamic Web page to find the corresponding IP.
dynamically generates HTML tables.
Quickly establish a "customer reply" system so that Web visitors can send a letter from the Web page to the webmaster.
Let the Web page can record the behavior of the Web browser, that is, log.
The 6th to 13th chapters, we will introduce some very important, very common, but more complex library suite use method, these chapters are in the kit for the introduction of the spindle, that is, a chapter only introduce a suite, in order to make these important packages of the more important features, detailed introduction to everyone.
These kits (packages) include: Database connection Kit, form authoring kit, identity Kit, archive upload kit, paging suite, and more.
Finally, attached to the official website of Pear to do a detailed introduction, when you enter the world of pear, you will often come to this site to find information. Knowing how to use the official website is very important for pear PHP developers. The attached B will be a simple introduction to PHP's object-oriented programming design.
The categories that are preferred and suitable for use by pear are as follows:
PHP enthusiasts, that must use pear, because it is absolutely awesome.
PHP's professional programmer. What you need is code security, repeatability, and good productivity, pear absolutely necessary.
PHP programmer, want to develop more interesting, more powerful applications, but do not want to be written PHP program some of the trouble tied, pear can definitely meet your requirements.
Write your own PHP program, but do not like to start from scratch every time, a word to beat the code, pear can improve your productivity.
You want to learn the powerful, high-security PHP, and when you learn the basic syntax of PHP, you can try to use pear.
You need a tailor-made PHP application, in other words, you don't like a suite of apps like Xoops, try Pear.
You need a PHP application that is easy to maintain, you don't want to change the code later, or you can redesign the entire program because of the PHP revision.
You want your PHP program to be object-oriented, easy to swap and modular.
You want your PHP skills to the next level, want to learn more PHP-related knowledge, through the use of pear or watch Pear's original code, it is a good way to learn.
Pear is written specifically for those who have the above needs.
Using pear is like building a house. It is to let you use precast pieces of the way, to build a large house of their own design and construction, but do not need to stir their own cement, prepare their own sand, stone, self-burning tiles. Do their own aluminum doors and windows, their own carpentry decoration and so on ....
Pear is like a prefab that has been prepared and ready for your needs, and you just need to combine them with ideas.
When we use pear to write PHP programs, we must have a first-order condition, that is, the knowledge of PHP must have a certain understanding.
If you do not know what PHP is, what is Apache, Mysql, or if you know that it does not have the basic syntax of PHP, then this article is not for you at this time. It is recommended that you go to buy some php, Apach, MySQL primer books, read on to see this article.
Everyone is not necessarily a PHP master, but must have the ability to read basic PHP code. In any case, the first love of PHP is the most basic prerequisite for reading the book.
Chapter II
PHP has a lot of norms and grammar, we do not introduce, please have time to read about the PHP books, we are focused on the development of PHP to 4.0 version later. Added the function of object-oriented (object-oriented programming Language), although it is not possible to complete object-oriented like Java, However, compared to the previous version of PHP3.0 has been a big step forward, but also for PHP program developers to provide more powerful and more convenient development capabilities.
PHP version 5.0 and above, has been transformed into a thorough object-oriented, providing more complete object-oriented functions. The Pear Library We are introducing is fully supported for PHP 4.3.0 and above. This point please rest assured.
For most people to think about, but also considering the compatibility of PHP downward, the content and examples of this book can be in PHP 4.3.0 version of the environment above, because pear fully support php 4.3. More than 0 versions, less than PHP 4.3.0 version of the environment, pear is mostly supported, Only a small part does not support.
What is PHP object-oriented? Object-oriented syntax is less visible in traditional PHP programs, but if you understand Java as a programming language, you should be able to know what the object-oriented, I will be in the attached to the object-oriented guide to make simple to explain.
In addition, I would like to emphasize that: PHP In addition to the basic syntax, the inside of the function is more than thousands, horizontally up to hundreds of different types, including text functions, digital functions, database classes, graphics and so on, the function is quite strong, upbraid tongue. However, compared to programmers, how to use these functions, with PHP syntax to write effective and well-managed code, will be a major challenge.
Today, with pear, the wisdom that is produced by many of the world's top PHP gurus, allows us to write code easily and efficiently and overcome many of the difficulties in writing. In the case of the martial arts world, writing PHP with Pear is like hundreds of martial arts masters pouring their skill to programmers. Let the program developers do not from the most basic practice, put down horse training, borrowing their skills can be very easy to multiply, efficiency doubled.
Say for a long, what is pear? The next unit is the author to do an introduction.
The word pear literally means "pears".
A pear. The official website is http://pear.php.net
Examples can be found in the logo of the official website of Pear.
The beginning of the pear is from November 1999 to 2l Day. A man named Stig S.bakken, who launched a project and called for a lot of PHP gurus to work together, first set up some code-based rules for the project, and hopefully the PHP code written by PHP developers to join the project will need to follow these rules.
This project name is pear, actually is the abbreviation of PHP Extension and application repository, meaning "php continuation and application Library", simply said, Pear is actually a PHP library.
Mr. Bakken the code base is as follows, and I'll just outline it and say something about the details:
If the developer wants to provide a PHP library, the structure of the program must be object-structured.
Program indentation to follow a certain format
The naming of classes in programs must also follow a certain format
The code should have a certain format.
File naming must be in a certain format
The package is packaged when the library is written, and the package and installation methods are also available in a certain format.
The project welcomes all PHP developers to develop PHP libraries together as long as they are willing to follow the code base rules described above. Mr. Bakken organized a team as the control body for the project, reviewing the libraries provided by all the developers involved in the project, classifying the library and putting it on the official website for other developers to download, and also maintaining and updating the official website.
Some people may be curious, why would anyone want to write a library for free and let others use it? This is the spirit of the open source world of mutual assistance, sharing. Imagine that every developer who develops a library for his or her own part of the program for others to use, while also enjoying the libraries released by other developers, is not going to be able to achieve mutual help, so that each developer can share the results of all developers. You don't have to write all the code yourself.
Even better, these libraries are free to be used by people all over the world, not just developers who participate in library development (which is the same approach as Java or Perl provides a library of functions).
Therefore, all the PHP developers around the world can save a lot of time to write code, and because the developers using the library can return the library to the original developer, the original developer will constantly fix these libraries, so the code is relatively safe. In addition, the library developers will evolve with the times, adding new features to the library, so that users of the library can keep up with the times.
For details, refer to the Pear's official website for the purpose of developing pear: http://pear.php.net/manual/en/about-pear.php. I suggest you have time to look slowly, continue to see this article, you will slowly understand the magic of pear.
I have a chapter at the end of the article attached: Pear official website Introduction, we can first refer to.
If you don't know what I mean by introducing the so-called "library," it doesn't matter, and the next section will explain it in real-world examples.
2-3 Introduction to All Kits
▓ Library vs Suite
Before we introduce all the kits, we have to clear two nouns to avoid confusing readers, one is "library" and the other is "suite".
If I were a PHP developer, I developed a library that could handle all of the database accesses, and would like to add this library to pear to share with the world. After I wrote the library library, I had to compress the library into a "pear" as per the rules of the Code. "Document, on the official website of pear for everyone to download, and to follow the pear rules to compress the file, this suite can be installed or managed with Pear Suite management instructions, which is very convenient for the pear users, for the package management instructions, I will do in the next chapter full of the said, I believe that the reader should understand what "Library", What is "suite"? In fact, simply put the library into a package.
▓ Kits and Categories
Pear has so far released more than 300 kits, divided into 35 categories, and constantly increasing. You can imagine the combination of top PHP developers around the world as a unifying force. is the category of the packages on the official website:
Pear because of the release of the package too much, in order to manage the convenience of the package according to the function of the suite to classify, the same class of suites in effect have relevance, but the functionality is not the same small next, I will all the classification of the form of a simple introduction, Let's learn more about what features the Pear Suite can provide.
With so many classifications, each class will develop a different set depending on the functionality. Take the first certification class for example, if you go to the official website to see, you will find that there are currently 8 packages in this category
These 8 packages are all related to identity authentication, if you want the Web page to have identity authentication function, for example, can let the Web browser register, enter the account password, identify, give permission and so on. You will need to use these kits.
Let me add that some of the packages have matured and developers will call it stable (stable), but if the library is still in development, but it is already available, the developer releases it, often called the beta version (Alpha or beta). The official website will also record the name of the developer and maintainer of the kit, and sometimes a suite is developed jointly by many people.
The information for these kits can be found on the official website of pear, and I'll show you how to use the Pear website on the official website of the attached 〈pear.
2-4 Simple example of using the Pear Library
In this section, I use a simple example to illustrate the usage of the library.
If you want to make a Web page and want to know the time it takes to execute the page, you can borrow a library named benchmark that pear. The purpose of this library is to calculate the execution time of the Web page.
First, install the benchmark Library kit (see the next chapter for installation methods). Then we can start writing the Web page, for example: we have created a Web page called show.php.
Based on the convenience of the Ming, I put the line number in front of each stroke, we actually write the program without adding a line number.
The code for Lines 1th and 2nd first refers to the Timer.php Web page in the benchmark suite, which contains a library of calculation page execution times. Include_once can put an external page to this page, I call this action called "reference", this example is quite the implementation of the timer.php and show.php two pages.
Line 3rd, create a Benchmark_timer object with the New keyword and put the object in a variable named $timer. Then use the start () method of the thin $timer object to activate the clock and add my own code, in this case a simple one-line program.
The next step is to end the clock, calculate the time it takes to execute the page, and display it. Line 8th uses the Stop () method of the $timer object to stop the clock and calculates the time difference between the clock starting from start to stop and the result of the timeelapsed () method with the 9th Line $timer object, and puts the results into the $totaltime variable.
Finally, the Echo function is used to display the time difference on the webpage.
It is clear from the results that the Show.php Web page has taken 0.00013613700866699 seconds from execution to completion, and can then be used to judge system performance by observing this number, or as a reference for code improvement. How to calculate the execution time is not convenient, fast and magical!
If you need to be on other pages can also have the ability to calculate the execution time of the page, as long as the above-mentioned way to apply to other PHP pages.
In fact, other kits are used in the same way that this suite is used in Datong small differences. The difference is that the classes, methods, and parameters used in each suite are different.
Although the kit is easy to use, I believe readers still have a lot of doubts. For example:
1. How does the benchmark Library suite come in? What pre-work can I use it for?
2. How do I know the way to use the benchmark kit?
The 1th question concerns how to install the Pear Suite, as well as the management, upgrade, and removal of the post-installation package, which I'll cover in chapter 3rd. 2nd question, the author will be in the 4th chapter on how to use the kit, how to get the information of the package to make a detailed explain.
2-5 Why Use Pear
Why use pear? According to my own experience, summed up the following points:
1. Save time and effort: Many of the code is written in the library, and developers simply have to refer to the PHP file with the library to have the functionality provided by the library, eliminating the time and effort to compose themselves.
2. Security: Since these libraries are exposed to the original code, the user can immediately report the bug to the developer of the suite, and the developer will usually be corrected immediately to minimize the error of the library.
3. Easy to maintain: the self-authored code is separate from the code in the Pear library, and if the Pear suite releases the new version due to new features being developed or bug fixes, simply update the package and never move to your own code.
4. Powerful features: The Pear Suite offers a very large number of functions, in addition to commonly used functions such as: Database links, profile processing, identity authentication, and the processing of forms. In addition, the more advanced functions, such as the network Post Office, network management, dynamic mode of production graphics, RSS, Wiki, or like phpBB bbcode resolution, etc. can be easily done.
5. Separate the programming of the Web page from the layout: Pear provides a number of libraries that allow programming to be separated from the layout, making it easier for programmers to cooperate with web designers.
6. Learning PHP is an excellent example of learning: The Code of the library is very detailed, code writing, with a certain set of rules and formats, and completely materialistic, so that developers can easily understand and learn. Some kits also have teaching documentation and examples, and most importantly: you don't have to spend half a dime to get it, we should thank the authors of the package for their selfless contribution.
2-6 Why to establish Pear society
What causes PHP developers all over the world to unite and develop the pear of this program? I think there are several reasons for this:
1. A strong competition from other competitors: This 1th chapter has been said to be clear.
2. The substance of PHP: After adding material-oriented function from PHP4, PHP5 is further materialistic. In addition to with ASP. NET, JSP, is easy to program the modular, so that the development of the library can be carried out, with the physical function, the library can be written with the developer's own code cutting.
3. The common needs of developers: if every time the development of PHP program, you have to completely from scratch, although you can exercise the skills of the program, but it is not efficient, and not very economical. Some of the most common features that can be handled in a library will solve many developers ' difficulties. Based on the common needs of all developers, these PHP developers work together to develop libraries and help others.
2-7 PHP's competitors and pros and cons
PHP was developed in 1994, after four major rewriting, as we see today can be widely used and mature product. By April 2005, PHP has been used on more than 19 million websites worldwide, and this number continues to grow rapidly.
Compared to their competing rivals, PHP has the following advantages:
High efficiency: Not my guangzhoa sell melon, haha ..., I have read a lot of ASP. NET and JSP pages, the performance is really not compared with PHP. (the user of ASP. NET and JSP should not read this article).
Can be linked to many different database systems: Other competitors can, but no PHP is fast.
Easy to learn and use: PHP code is very intuitive, easy to learn.
Support Object-oriented: JSP is strong in this respect, but PHP5 has been caught up.
Low cost: no money at all.
There are a lot of library: I remember the author used ASP, the built-in function library is very few poor.
Open source code: Security will be higher than not open.
Pear Library: This is the latest powerful weapon to fight against the enemy.
Carrying: PHP is available for all types of UNIX operating systems, such as: Linux,freebsd, Commercial UNIX, or Windows operating systems.
What are the advantages of ASP. For example, JSP with Java powerful features, it can present some of the effects that PHP cannot do. So JSP also attracts a lot of users, but the author of the current effectiveness of JSP is not very satisfied, on the contrary, the speed of PHP is very satisfied.
It is up to you to make a clear choice of which program to use, but if you choose to watch the article, believe that we should all be fellow human, PHP enthusiasts.
All in all, many PHP pros together build a strong support network, if you are PHP programmers, but the good intentions of these experts ungrateful, it is not too bad?

The above describes what is the APEC conference PHP What is pear? , including what is the APEC meeting content, want to be interested in PHP tutorial friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.